Update article.md

instanceof is only looking for Animal.prototype in the prototype chain, don't Rabbit.prototype
This commit is contained in:
LexaWin 2021-10-11 21:32:36 +03:00 committed by GitHub
parent 193319c963
commit 91a89eac20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,7 +93,7 @@ The algorithm of `obj instanceof Class` works roughly as follows:
alert(rabbit instanceof Animal); // true
*/!*
// rabbit.__proto__ === Rabbit.prototype
// rabbit.__proto__ === Animal.prototype (no match)
*!*
// rabbit.__proto__.__proto__ === Animal.prototype (match!)
*/!*