File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ const member = [ 'lutfy' , 'Zoro' , 'Sanji' ] ;
2
+
3
+ localStorage . setItem ( 'SHP' , JSON . stringify ( member ) ) ;
4
+
5
+ // getItem lutfy
6
+ const lutfyy = JSON . parse ( localStorage . getItem ( 'SHP' ) ) ;
7
+ // index 0 without JSON.parse will print [,
8
+ // index 1 will print l, dsst
9
+ console . log ( lutfyy [ 0 ] ) ;
10
+
11
+ let marineford ;
12
+
13
+ if ( localStorage . getItem ( 'marineford' ) ) {
14
+ marineford = JSON . parse ( localStorage . getItem ( 'marineford' ) ) ;
15
+ } else {
16
+ marineford = [ ] ;
17
+ }
18
+
19
+ console . log ( marineford ) ; // []
20
+ // marineford.push('kizaru');
21
+ // // marineford.push('akainu');
22
+ // localStorage.setItem('marinford', JSON.stringify(marineford));
23
+ marineford . push ( 'Garp' ) ;
24
+ marineford . push ( 'akainu' ) ;
25
+ localStorage . setItem ( 'marineford' , JSON . stringify ( marineford ) ) ;
Original file line number Diff line number Diff line change @@ -236,6 +236,7 @@ <h1>Local Storage</h1>
236
236
<!-- <script src="/22_propogation_bubbling_capturing.js"></script> -->
237
237
<!-- <script src="/23_example.js"></script> -->
238
238
<!-- <script src="/24_forms_event_submit.js"></script> -->
239
- < script src ="/25_local_storage.js "> </ script >
239
+ <!-- <script src="/25_local_storage.js"></script> -->
240
+ < script src ="/26_with_multiple_value.js "> </ script >
240
241
</ body >
241
242
</ html >
You can’t perform that action at this time.
0 commit comments