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
This commit is contained in:
lumosmind 2019-10-29 15:36:57 +03:00 committed by GitHub
parent d5195b5d59
commit b32ce2c9a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
```