Shenglian / -WORK_TIP

工作上小技巧
4 stars 1 forks source link

[js] localstorage #146

Open Shenglian opened 5 years ago

Shenglian commented 5 years ago
localStorage
 - length 
 - key
 - getItem
 - setItem
 - removeItem
 - clear

for (let i = 0, len = localStorage.length; i < len; i++) {
 console.log( `${localStorage.key(i)} => ${localStorage.getItem(localStorage.key(i))}` )
}