Update 1-js/08-prototypes/01-prototype-inheritance/article.md
Co-Authored-By: Alexey Pyltsyn <lex61rus@gmail.com>
This commit is contained in:
parent
3c8ae3090d
commit
d0b95aa8df
1 changed files with 1 additions and 1 deletions
|
@ -246,7 +246,7 @@ The resulting picture:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
If we had other objects like `bird`, `snake` etc. inheriting from `animal`, they would also gain access to methods of `animal`. But `this` in each method call would be the corresponding object, evaluated at the call-time (before dot), not `animal`. So when we write data into `this`, it is stored into these objects.
|
If we had other objects like `bird`, `snake` etc., inheriting from `animal`, they would also gain access to methods of `animal`. But `this` in each method call would be the corresponding object, evaluated at the call-time (before dot), not `animal`. So when we write data into `this`, it is stored into these objects.
|
||||||
|
|
||||||
As a result, methods are shared, but the object state is not.
|
As a result, methods are shared, but the object state is not.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue