localStorage

sava data and read data

localStorage.a=3
localStorage["a"]='apple'
localStorage["a"]//"apple"
localStorage.setItem('a','orange')
localStorage.a//"orange"
localStorage.getItem("a")//"orange"
localStorage.removeItem("a")
localStorage.getItem("a")//null

an example




 

刷新页面会看到计数器在增长。

请关闭浏览器窗口,然后再试一次,计数器会继续计数。

你可能感兴趣的:(localStorage)