From b32ce2c9a08033eafadc24a9d6c0344caabb6092 Mon Sep 17 00:00:00 2001 From: lumosmind <12192118+lumosmind@users.noreply.github.com> Date: Tue, 29 Oct 2019 15:36:57 +0300 Subject: [PATCH] coding style conflict with the tutorial itself variable user is using for both string and object type different values. these situation is called "ninja code" bu author :) "Add a new variable only when absolutely necessary. Instead, reuse existing names. Just write new values into them." https://javascript.info/ninja-code --- 1-js/05-data-types/12-json/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/05-data-types/12-json/article.md b/1-js/05-data-types/12-json/article.md index 2942cdd8..a5f2974a 100644 --- a/1-js/05-data-types/12-json/article.md +++ b/1-js/05-data-types/12-json/article.md @@ -425,9 +425,9 @@ alert( numbers[1] ); // 1 Or for nested objects: ```js run -let user = '{ "name": "John", "age": 35, "isAdmin": false, "friends": [0,1,2,3] }'; +let userData = '{ "name": "John", "age": 35, "isAdmin": false, "friends": [0,1,2,3] }'; -user = JSON.parse(user); +let user = JSON.parse(userData); alert( user.friends[1] ); // 1 ```