This commit is contained in:
Ilya Kantor 2019-08-06 00:14:10 +03:00
parent f72af57b17
commit cc25e231f4
2 changed files with 2 additions and 2 deletions

View file

@ -6,7 +6,7 @@ importance: 5
The task has two parts. The task has two parts.
We have an object: We have objects:
```js ```js
let head = { let head = {

View file

@ -10,7 +10,7 @@ Let's look carefully at what's going on in the call `speedy.eat("apple")`.
So all hamsters share a single stomach! So all hamsters share a single stomach!
Every time the `stomach` is taken from the prototype, then `stomach.push` modifies it "at place". Both for `lazy.stomach.push(...)` and `speedy.stomach.push()`, the property `stomach` is found in the prototype (as it's not in the object itself), then the new data is pushed into it.
Please note that such thing doesn't happen in case of a simple assignment `this.stomach=`: Please note that such thing doesn't happen in case of a simple assignment `this.stomach=`: