JSFiddle - React, Tailwind, and code Playground
by kasperfish
HTML
<input type = "text" id = "testInput"></input>
<input type = "button" value = "Add Array" onclick = "addArray();"> </input>
<input type = "button" value = "See Result" onclick = "seeResult();"></input>
JavaScript
var result=[];
function addArray(){
var userInput = document.getElementById("testInput").value;
result.push(userInput);
document.getElementById("testInput").value="";
}
function seeResult(){
alert("the result array contains: "+result+"\nResults will get removed");
result=[];//empty result array
}