Skip to content

Commit dc1a4fb

Browse files
committed
2 parents 0ad6ba0 + 07b8022 commit dc1a4fb

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

1-js/07-object-oriented-programming/01-property-descriptors/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Object.defineProperty(obj, propertyName, descriptor)
6868
`descriptor`
6969
: Property descriptor to apply.
7070

71-
If the property exist, it updates its flags, otherwise, it creates the property with the given value and flags. Please note, that if a flag is not supplied, it is assumed `false`.
71+
If the property exists, `defineProperty` updates its flags. Otherwise, it creates the property with the given value and flags; in that case, if a flag is not supplied, it is assumed `false`.
7272

7373
For instance, here a property `name` is created with all falsy flags:
7474

@@ -96,7 +96,7 @@ alert( JSON.stringify(descriptor, null, 2 ) );
9696
*/
9797
```
9898

99-
Compare it with "normally created" user.name above: now all flags are falsy. If that's not what we want then we'd better to set them to `true` in the `descriptor`.
99+
Compare it with "normally created" `user.name` above: now all flags are falsy. If that's not what we want then we'd better set them to `true` in `descriptor`.
100100

101101
Now let's see effects of the flags by example.
102102

@@ -209,7 +209,7 @@ Math.PI = 3; // Error
209209
// delete Math.PI won't work either
210210
```
211211

212-
Making a property non-configurable is one-way road. We cannot change it back, because `defineProperty` doesn't work on non-configurable properties.
212+
Making a property non-configurable is a one-way road. We cannot change it back, because `defineProperty` doesn't work on non-configurable properties.
213213

214214
Here we are making `user.name` a "forever sealed" constant:
215215

@@ -266,7 +266,7 @@ So, we can set many properties at once.
266266

267267
To get many descriptors at once, we can use the method [Object.getOwnPropertyDescriptors(obj)](mdn:js/Object/getOwnPropertyDescriptors).
268268

269-
Together with `Object.defineProperties` it can be used as an "flags-aware" way of cloning an object:
269+
Together with `Object.defineProperties` it can be used as a "flags-aware" way of cloning an object:
270270

271271
```js
272272
let clone = Object.defineProperties({}, Object.getOwnPropertyDescriptors(obj));

1-js/07-object-oriented-programming/02-property-accessors/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ alert(user.fullName); // John Smith
5555
*/!*
5656
```
5757

58-
From outside, an accessor property looks like a regular one. That's the idea of accessor properties. We don't call `user.fullName` as a function, we read it normally: the getter runs behind the scenes.
58+
From outside, an accessor property looks like a regular one. That's the idea of accessor properties. We don't *call* `user.fullName` as a function, we *read* it normally: the getter runs behind the scenes.
5959

6060
As of now, `fullName` has only a getter. If we attempt to assign `user.fullName=`, there will be an error.
6161

@@ -97,7 +97,7 @@ Sometimes it's normal that there's only a setter or only a getter. But the prope
9797

9898
## Accessor descriptors
9999

100-
Descriptors for accessor properties are different.
100+
Descriptors for accessor properties are different -- as compared with data properties.
101101

102102
For accessor properties, there is no `value` and `writable`, but instead there are `get` and `set` functions.
103103

@@ -182,7 +182,7 @@ Technically, the external code may still access the name directly by using `user
182182

183183
## Using for compatibility
184184

185-
One of great ideas behind getters and setters -- they allow to take control over a "normal" data property and tweak it at any moment.
185+
One of the great ideas behind getters and setters -- they allow to take control over a "normal" data property and tweak it at any moment.
186186

187187
For instance, we started implementing user objects using data properties `name` and `age`:
188188

1-js/07-object-oriented-programming/03-prototype-inheritance/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ rabbit.walk = function() {
159159
rabbit.walk(); // Rabbit! Bounce-bounce!
160160
```
161161

162-
Since now, `rabbit.walk()` call finds the method immediately in the object and executes it, without using the prototype:
162+
From now on, `rabbit.walk()` call finds the method immediately in the object and executes it, without using the prototype:
163163

164164
![](proto-animal-rabbit-walk-2.png)
165165

@@ -192,7 +192,7 @@ alert(admin.fullName); // John Smith (*)
192192
admin.fullName = "Alice Cooper"; // (**)
193193
```
194194

195-
Here in the line `(*)` the property `admin.fullName` has a getter in the prototype `user`, so it is called. And in the line `(**)` the property is has a setter in the prototype, so it is called.
195+
Here in the line `(*)` the property `admin.fullName` has a getter in the prototype `user`, so it is called. And in the line `(**)` the property has a setter in the prototype, so it is called.
196196

197197
## The value of "this"
198198

1-js/07-object-oriented-programming/04-function-prototype/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ As we know already, `new F()` creates a new object. But what we didn't use yet `
1414

1515
That property is used by the JavaScript itself to set `[[Prototype]]` for new objects.
1616

17-
**When a new object is created with `new F()`, the `[[Prototype]]` of it is set to `F.prototype`.**
17+
**When a new object is created with `new F()`, the object's `[[Prototype]]` is set to `F.prototype`.**
1818

1919
Please note that `F.prototype` here means a regular property named `"prototype"` on `F`. It sounds something similar to the term "prototype", but here we really mean a regular property with this name.
2020

1-js/07-object-oriented-programming/05-native-prototypes/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function showArgs() {
169169
}
170170
```
171171

172-
That's more efficient, because evades creation of an extra array object `[]`. From the other side -- more letters to write it.
172+
That's more efficient, because it avoids the creation of an extra array object `[]`. On the other hand, it is longer to write.
173173

174174
## Summary
175175

1-js/07-object-oriented-programming/06-prototype-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Methods for prototypes
33

4-
In this chapter we cover additional methods to work with the prototype.
4+
In this chapter we cover additional methods to work with a prototype.
55

66
There are also other ways to get/set a prototype, besides those that we already know:
77

0 commit comments

Comments
 (0)