+ 9

localStorage

How can I save data in an array, regardless whether you restarted the code heard about localStorage

21st Aug 2019, 6:41 AM
No activity
3 Answers
+ 4
can be an example in code?
21st Aug 2019, 7:44 AM
No activity
+ 3
// setItem var arr = [1, 2, 3] localStorage.setItem("arr", JSON.stringify(arr)); // getItem var arr = localStorage.getItem("arr"); arr = arr ? JSON.parse(arr) : [];
21st Aug 2019, 7:41 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 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.
23rd Aug 2019, 2:31 AM
Capt_Crunch
Capt_Crunch - avatar