+ 9
localStorage
How can I save data in an array, regardless whether you restarted the code heard about localStorage
3 odpowiedzi
+ 4
can be an example in code?
+ 3
// setItem
var arr = [1, 2, 3]
localStorage.setItem("arr", JSON.stringify(arr));
// getItem
var arr = localStorage.getItem("arr");
arr = arr ? JSON.parse(arr) : [];
+ 2
This is in HTML5. Its for sites to allow customers to use storage on there computer. Setltem is while they are there once they leave the storage space is returned to the system. And getltem is storage they can use for up to a year.