I have a blank array in my javascript called Counter
. When I run the test()
function, I want it to add a value to the array and change HTML pages. But while in the second page, if I console.log(Counter)
, it appears as blank.
How can I add a value to the array while maintaining it when changing pages?
Javascript
var Counter = [];
function test() {
Counter.push("1")
window.location.replace("page2.html")
}