I have an array in my code that changes value through a function.
var arr = [];
function arrfunction() {
arr.push(1);
}
I then change my HTML page to a different one using:
windows.location.replace("page2.html");
Since I change pages, my variable resets. I have tried to use sessionStorage to store arr, but I have to use JSON.stringify() to convert it into a string. The issue is, I need arr to remain as an array for later use.
Is there a way I can store my variable and also keep it as an array?