You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/09-classes/02-class-inheritance/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ rabbit.hide(); // Белый кролик прячется!
82
82
```
83
83
Теперь код `Rabbit` стал короче, так как используется конструктор класса `Animal` по умолчанию и кролик может использовать метод `run` как и все животные.
84
84
85
-
На самом деле ключевое слово `extends`добавляет ссылку на `[[Prototype]]`из `Rabbit.prototype` в `Animal.prototype`:
85
+
Ключевое слово `extends`работает, используя прототипы. Оно устанавливает `Rabbit.prototype.[[Prototype]]`в `Animal.prototype`. Так что если метод не найден в `Rabbit.prototype`, JavaScript берёт его из `Animal.prototype`.
0 commit comments