localStorage的增刪改查

 1 var _localStorage = window.localStorage;
 2 undefined
 3 /**/
 4 _localStorage.name = '張泰鬆'
 5 "張泰鬆"
 6 _localStorage['age'] = 28
 7 28
 8 _localStorage.setItem('address','杭州市西湖區')
 9 undefined
10 /**/
11 _localStorage.name = '張泰鬆1'
12 "張泰鬆1"
13 _localStorage['age'] = 29
14 29
15 _localStorage.setItem('address','杭州市西湖區1')
16 undefined
17 /**/
18 _localStorage.age
19 "29"
20 _localStorage['name']
21 "張泰鬆1"
22 _localStorage.getItem('address')
23 "杭州市西湖區1"
24 /**/
25 delete _localStorage.name
26 true
27 delete _localStorage['age']
28 true
29 _localStorage.removeItem('address')
30 undefined
相關文章
相關標籤/搜索