Skip to content

Commit 33642d3

Browse files
committed
fixes
1 parent f49e438 commit 33642d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

1-js/09-classes/02-class-inheritance/article.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ Internally, `extends` keyword works using the good old prototype mechanics. It s
6161

6262
![](animal-rabbit-extends.svg)
6363

64+
For instance, to find a method for `rabbit.hide()`, the engine checks:
65+
1. The `rabbit` object (no `hide`).
66+
2. Its prototype, that is `Rabbit.prototype` (also no `hide`).
67+
3. Its prototype, that is (due to `extends`) `Animal.prototype`, that has the method.
68+
6469
As we can recall from the chapter <info:native-prototypes>, JavaScript uses prototypal inheritance for build-in objects. E.g. `Date.prototype.[[Prototype]]` is `Object.prototype`, so dates have generic object methods.
6570

6671
````smart header="Any expression is allowed after `extends`"

0 commit comments

Comments
 (0)