<input type="text" id="inp">
<button class="btn">Push to array</button>
var inp = document.getElementById("inp");
var btn = document.querySelector(".btn");
var arr = [];
btn.addEventListener('click', function() {
var valInp = inp.value;
arr.push(valInp);
console.log(arr);
inp.value = "";
})