Skip to content

Commit b32ce2c

Browse files
authored
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 parent d5195b5 commit b32ce2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1-js/05-data-types/12-json/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,9 @@ alert( numbers[1] ); // 1
425425
Or for nested objects:
426426

427427
```js run
428-
let user = '{ "name": "John", "age": 35, "isAdmin": false, "friends": [0,1,2,3] }';
428+
let userData = '{ "name": "John", "age": 35, "isAdmin": false, "friends": [0,1,2,3] }';
429429

430-
user = JSON.parse(user);
430+
let user = JSON.parse(userData);
431431

432432
alert( user.friends[1] ); // 1
433433
```

0 commit comments

Comments
 (0)