We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bf8830 commit 237920bCopy full SHA for 237920b
6-data-storage/02-localstorage/article.md
@@ -127,17 +127,17 @@ Please note that both key and value must be strings.
127
If were any other type, like a number, or an object, it gets converted to string automatically:
128
129
```js run
130
-sessionStorage.user = {name: "John"};
131
-alert(sessionStorage.user); // [object Object]
+localStorage.user = {name: "John"};
+alert(localStorage.user); // [object Object]
132
```
133
134
We can use `JSON` to store objects though:
135
136
137
-sessionStorage.user = JSON.stringify({name: "John"});
+localStorage.user = JSON.stringify({name: "John"});
138
139
// sometime later
140
-let user = JSON.parse( sessionStorage.user );
+let user = JSON.parse( localStorage.user );
141
alert( user.name ); // John
142
143
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments