I need to add a variable’s string to an array and then I need to change the value of the variable without changing the value in the string.
//Random Number Generator
let number = Math.floor(Math.random() * 89173458943);
//JS array
let array = [number];
console.log(array);
The a new number is generated every time and I need the array to save the number then add a new spot for another number.
I have tried local storage API but that does not work. This resulted in the last inputed number saving even when I reopened the page. I also can’t find any methods or properties that work on the array. That resulted in nothing. I really need help.