0
我有:
localStorage.xxx = JSON.stringify([["something","hello"],["something2","hello2"]]);
。
如何添加JSON xxx
中的新阵列,如["something3","hello3"]
。将元素添加到localStorage中的json
我有:
localStorage.xxx = JSON.stringify([["something","hello"],["something2","hello2"]]);
。
如何添加JSON xxx
中的新阵列,如["something3","hello3"]
。将元素添加到localStorage中的json
你的意思是这样的:
var arr = JSON.parse(localStorage.xxx) ;
arr.push(["something3","hello3"]) ;
localStorage.xxx = JSON.stringify(arr) ;
你把它放回localStorage的前再次寻找的东西比分析保存在localStorage的json的,修改你的对象/数组,字符串化则是更聪明? – kinakuta 2012-04-06 09:38:58