en.javascript.info/1-js/9-object-inheritance/16-instanceof/2-instanceof-result/solution.md
Ilya Kantor d4c714cbe1 work
2016-08-05 16:53:08 +03:00

17 lines
400 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Да, распознает.
Он проверяет наследование с учётом цепочки прототипов.
```js run
function Animal() {}
function Rabbit() {}
Rabbit.prototype = Object.create(Animal.prototype);
var rabbit = new Rabbit();
alert( rabbit instanceof Rabbit ); // true
alert( rabbit instanceof Animal ); // true
alert( rabbit instanceof Object ); // true
```