I am trying to retrieve the array from the local storage and display it in innerHTMl. But every time I do a refresh there is nothing in my innerHTML. Although the array is visible in the browser LocalStorage.
document.getElementById("submit").addEventListener("click", arrpush);
var arr = JSON.parse(localStorage.getItem(arr)) || [];
function arrpush(){
arr.push(document.getElementById('text').value);
document.getElementById("items").innerHTML = "";
localStorage.arr = JSON.stringify(arr);
display();
}
function display(){
document.getElementById("items").innerHTML = "";
for(i=0;i<arr.length;i++){
document.getElementById("items").innerHTML += `<li>${arr[i]}</li>`;
}
}