javascript localstorage store Array

localstorage存陣列

範例如下:

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


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