最佳答案
如果我不需要localStorage,我的代码将如下所示:
var names=new Array();names[0]=prompt("New member name?");
这有效。但是,我需要将此变量存储在localStorage中,事实证明它非常顽固。我尝试过:
var localStorage[names] = new Array();localStorage.names[0] = prompt("New member name?");
我哪里做错了?