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

27 lines
516 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
---
# Найдите ошибку в наследовании
Найдите ошибку в прототипном наследовании. К чему она приведёт?
```js
function Animal(name) {
this.name = name;
}
Animal.prototype.walk = function() {
alert( "ходит " + this.name );
};
function Rabbit(name) {
this.name = name;
}
Rabbit.prototype = Animal.prototype;
Rabbit.prototype.walk = function() {
alert( "прыгает! и ходит: " + this.name );
};
```