javascript localstorage store Array

Share on FacebookShare on Google+Tweet about this on TwitterShare on Tumblr

localstorage存陣列

範例如下:

var names = [];
names[0] = prompt("New member name?");
localStorage["names"] = JSON.stringify(names);


var storedNames = JSON.parse(localStorage["names"]);