Skip to content

Commit 3c8ae30

Browse files
authored
Update article.md
Grammar
1 parent 30e3fa7 commit 3c8ae30

File tree

1 file changed

+5
-5
lines changed
  • 1-js/08-prototypes/01-prototype-inheritance

1 file changed

+5
-5
lines changed

1-js/08-prototypes/01-prototype-inheritance/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ rabbit.__proto__ = animal;
3434
```smart header="`__proto__` is a historical getter/setter for `[[Prototype]]`"
3535
Please note that `__proto__` is *not the same* as `[[Prototype]]`. That's a getter/setter for it.
3636

37-
It exists for historical reasons, in modern language it is replaced with functions `Object.getPrototypeOf/Object.setPrototypeOf` that also get/set the prototype. We'll study the reasons for that and these functions later.
37+
It exists for historical reasons. In modern language it is replaced with functions `Object.getPrototypeOf/Object.setPrototypeOf` that also get/set the prototype. We'll study the reasons for that and these functions later.
3838

3939
By the specification, `__proto__` must only be supported by browsers, but in fact all environments including server-side support it. For now, as `__proto__` notation is a little bit more intuitively obvious, we'll use it in the examples.
4040
```
@@ -203,7 +203,7 @@ Here in the line `(*)` the property `admin.fullName` has a getter in the prototy
203203

204204
## The value of "this"
205205

206-
An interesting question may arise in the example above: what's the value of `this` inside `set fullName(value)`? Where the properties `this.name` and `this.surname` are written: into `user` or `admin`?
206+
An interesting question may arise in the example above: what's the value of `this` inside `set fullName(value)`? Where are the properties `this.name` and `this.surname` written: into `user` or `admin`?
207207

208208
The answer is simple: `this` is not affected by prototypes at all.
209209

@@ -246,13 +246,13 @@ The resulting picture:
246246

247247
![](proto-animal-rabbit-walk-3.svg)
248248

249-
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.
249+
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.
250250

251251
As a result, methods are shared, but the object state is not.
252252

253253
## for..in loop
254254

255-
The `for..in` loops over inherited properties too.
255+
The `for..in` loop iterates over inherited properties too.
256256

257257
For instance:
258258

@@ -267,7 +267,7 @@ let rabbit = {
267267
};
268268

269269
*!*
270-
// Object.keys only return own keys
270+
// Object.keys only returns own keys
271271
alert(Object.keys(rabbit)); // jumps
272272
*/!*
273273

0 commit comments

Comments
 (0)