en.javascript.info/1-js/9-object-inheritance/10-class-inheritance/6-constructor-inherited/task.md
Ilya Kantor b0976b5253 up
2016-11-14 23:41:18 +03:00

21 lines
523 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.

importance: 5
---
# Что содержит constructor?
В коде ниже создаётся простейшая иерархия классов: `Animal -> Rabbit`.
Что содержит свойство `rabbit.constructor`? Распознает ли проверка в `alert` объект как `Rabbit`?
```js
function Animal() {}
function Rabbit() {}
Rabbit.prototype = Object.create(Animal.prototype);
var rabbit = new Rabbit();
alert( rabbit.constructor == Rabbit ); // что выведет?
```