I have to store an array in window.localStorage
. How would I store the array in window.localStorage
using console window?
EX:
cards: Array[0]
length: 0
I have to store this. Now here key is cards and length is nested.
localStorage
only support string
so you'll have to parse it to JSON
var arr = ["hello", "how", "are", "you", "doing"]; localStorage.setItem("test", JSON.stringify(arr));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.