fixes
This commit is contained in:
parent
773cc06a3b
commit
3073a5ca6d
1 changed files with 3 additions and 3 deletions
|
@ -61,10 +61,10 @@ Internally, `extends` keyword works using the good old prototype mechanics. It s
|
|||
|
||||

|
||||
|
||||
For instance, to find `rabbit.run` method, the engine checks:
|
||||
1. The `rabbit` object (has no `run`, only `name`).
|
||||
For instance, to find `rabbit.run` method, the engine checks (bottom-up on the picture):
|
||||
1. The `rabbit` object (has no `run`).
|
||||
2. Its prototype, that is `Rabbit.prototype` (has `hide`, but not `run`).
|
||||
3. Its prototype, that is (due to `extends`) `Animal.prototype`, that finally has the method.
|
||||
3. Its prototype, that is (due to `extends`) `Animal.prototype`, that finally has the `run` method.
|
||||
|
||||
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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue