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