我有:
localStorage.xxx = JSON.stringify([["something","hello"],["something2","hello2"]]);
。
如何在xxx
等JSON ["something3","hello3"]
中添加新数组。
答案 0 :(得分:2)
你的意思是:
var arr = JSON.parse( localStorage.xxx ) ;
arr.push( ["something3","hello3"] ) ;
localStorage.xxx = JSON.stringify( arr ) ;