取存localStorage 全部值

var ll = {}
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i); //获取本地存储的Key
ll[key] = localStorage.getItem(key)
}
console.info(JSON.stringify(ll))



var ll = {}
for (var key in ll) {
localStorage.setItem(key,ll[key])
}

posted @ 2023-10-19 14:45  外行的小白  阅读(338)  评论(0编辑  收藏  举报