Skip to content

Commit b77bc4e

Browse files
lumosmindViolet-Bora-Lee
authored andcommitted
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 d83519f commit b77bc4e

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 @@ alert( obj ); // "[object Object]" ?
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
그런데 이때 `Object.prototype` 위의 체인엔 `[[Prototype]]`이 없다는 점을 주의하셔야 합니다.

0 commit comments

Comments
 (0)