我有以下 localStorage 键:
localStorage.setItem(1, "some data");
localStorage.setItem(2, "some data");
localStorage.setItem(3, "some data");
.
.
.
localStorage.setItem(600, "some data");
如何在循环中附加到这些 Keys 新数据?
var i = 0
for(h=0;h<600;h++) {
key = i++;
localStorage.setItem(key, "new data");
}
这将覆盖我的原始密钥,而不是将“新数据”附加到“某些数据”。谢谢