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.
This commit is contained in:
parent
f38eb4e1b1
commit
8f3831be1c
1 changed files with 3 additions and 1 deletions
|
@ -33,7 +33,9 @@ We can check it like this:
|
|||
let obj = {};
|
||||
|
||||
alert(obj.__proto__ === Object.prototype); // true
|
||||
// obj.toString === obj.__proto__.toString == Object.prototype.toString
|
||||
|
||||
alert(obj.toString === obj.__proto__.toString); //true
|
||||
alert(obj.toString === Object.prototype.toString); //true
|
||||
```
|
||||
|
||||
Please note that there is no more `[[Prototype]]` in the chain above `Object.prototype`:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue