Skip to content

Commit 8f3831b

Browse files
authored
One line of code creates a lot of confusing
"// obj.toString === obj.__proto__.toString == Object.prototype.toString" It is look like JS code but it gives different result from what we want to get. There is different kind of equality operator ant these give more confusing what is the purpose of these? It can be better to separate this line into 2 line of code to make it sensible and readable. Subject and code is already hard but there is no need to make readers ask unnecessary questions.
1 parent f38eb4e commit 8f3831b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

1-js/08-prototypes/03-native-prototypes/article.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ We can check it like this:
3333
let obj = {};
3434

3535
alert(obj.__proto__ === Object.prototype); // true
36-
// obj.toString === obj.__proto__.toString == Object.prototype.toString
36+
37+
alert(obj.toString === obj.__proto__.toString); //true
38+
alert(obj.toString === Object.prototype.toString); //true
3739
```
3840

3941
Please note that there is no more `[[Prototype]]` in the chain above `Object.prototype`:

0 commit comments

Comments
 (0)