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

 

posted @ 2019-06-10 15:27  松松敲代码  阅读(662)  评论(0编辑  收藏  举报