From 237920b71ea72a5ca308c626fc5e4ad1e2db43fb Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Thu, 13 May 2021 17:40:00 +0300 Subject: [PATCH] Update article.md --- 6-data-storage/02-localstorage/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/6-data-storage/02-localstorage/article.md b/6-data-storage/02-localstorage/article.md index e2e2751d..d0483f3a 100644 --- a/6-data-storage/02-localstorage/article.md +++ b/6-data-storage/02-localstorage/article.md @@ -127,17 +127,17 @@ Please note that both key and value must be strings. If were any other type, like a number, or an object, it gets converted to string automatically: ```js run -sessionStorage.user = {name: "John"}; -alert(sessionStorage.user); // [object Object] +localStorage.user = {name: "John"}; +alert(localStorage.user); // [object Object] ``` We can use `JSON` to store objects though: ```js run -sessionStorage.user = JSON.stringify({name: "John"}); +localStorage.user = JSON.stringify({name: "John"}); // sometime later -let user = JSON.parse( sessionStorage.user ); +let user = JSON.parse( localStorage.user ); alert( user.name ); // John ```