Add items in a blank array and display the items


#1

Please Can Someone explain why should i add this line == elemnt.innerHTML = "";

var input = document.getElementById("input"),
but1 = document.getElementById("but1"),
but2 =document.getElementById("but2"),
elemnt = document.getElementById('element'),
i,
arr = [];

but1.onclick = function(){

 arr.push(input.value);

}

but2.onclick = function(){

**`elemnt.innerHTML = "";`**

for(i=0; i <arr.length; i++){

    elemnt.innerHTML += "Element " + i + " = " + arr[i] +"<br>";

}

#2

whenever you click on the but2 it'll replace element content with an empty string.
simply it'll be empty