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));
JSFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With