Skip to content

Commit 585c030

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-646989dd
2 parents abd81af + 646989d commit 585c030

File tree

17 files changed

+22
-21
lines changed

17 files changed

+22
-21
lines changed

1-js/04-object-basics/04-object-methods/2-check-syntax/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let user = {
1111
(user.go)() // error!
1212
```
1313

14-
The error message in most browsers does not give understanding what went wrong.
14+
The error message in most browsers does not give us much of a clue about what went wrong.
1515

1616
**The error appears because a semicolon is missing after `user = {...}`.**
1717

1-js/04-object-basics/04-object-methods/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ user.sayHi(); // Hello!
6161
```
6262

6363
```smart header="Object-oriented programming"
64-
When we write our code using objects to represent entities, that's called an [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming), in short: "OOP".
64+
When we write our code using objects to represent entities, that's called [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming), in short: "OOP".
6565
6666
OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture, and there are great books on that topic, like "Design Patterns: Elements of Reusable Object-Oriented Software" by E.Gamma, R.Helm, R.Johnson, J.Vissides or "Object-Oriented Analysis and Design with Applications" by G.Booch, and more.
6767
```
@@ -228,9 +228,9 @@ If you come from another programming language, then you are probably used to the
228228
229229
In JavaScript `this` is "free", its value is evaluated at call-time and does not depend on where the method was declared, but rather on what object is "before the dot".
230230
231-
The concept of run-time evaluated `this` has both pluses and minuses. On the one hand, a function can be reused for different objects. On the other hand, greater flexibility opens a place for mistakes.
231+
The concept of run-time evaluated `this` has both pluses and minuses. On the one hand, a function can be reused for different objects. On the other hand, the greater flexibility creates more possibilities for mistakes.
232232
233-
Here our position is not to judge whether this language design decision is good or bad. We'll understand how to work with it, how to get benefits and evade problems.
233+
Here our position is not to judge whether this language design decision is good or bad. We'll understand how to work with it, how to get benefits and avoid problems.
234234
```
235235
236236
## Internals: Reference Type

1-js/06-advanced-functions/06-function-object/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Now it works, because the name `"func"` is function-local. It is not taken from
329329
The outer code still has it's variable `sayHi` or `welcome`. And `func` is an "internal function name", how the function can call itself internally.
330330

331331
```smart header="There's no such thing for Function Declaration"
332-
The "internal name" feature described here is only available for Function Expressions, not to Function Declarations. For Function Declarations, there's just no syntax possibility to add a one more "internal" name.
332+
The "internal name" feature described here is only available for Function Expressions, not for Function Declarations. For Function Declarations, there is no syntax for adding an "internal" name.
333333
334334
Sometimes, when we need a reliable internal name, it's the reason to rewrite a Function Declaration to Named Function Expression form.
335335
```

1-js/06-advanced-functions/10-bind/4-function-property-after-bind/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# Function property after bind
66

7-
There's a value in the property of a function. Will it change after `bind`? Why, elaborate?
7+
There's a value in the property of a function. Will it change after `bind`? Why, or why not?
88

99
```js run
1010
function sayHi() {

1-js/06-advanced-functions/10-bind/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ alert( triple(5) ); // = mul(3, 5) = 15
258258
259259
Why do we usually make a partial function?
260260
261-
The benefit is that we can create an independent function with a readable name (`double`, `triple`). We can use it and not provide first argument of every time as it's fixed with `bind`.
261+
The benefit is that we can create an independent function with a readable name (`double`, `triple`). We can use it and not provide the first argument every time as it's fixed with `bind`.
262262
263263
In other cases, partial application is useful when we have a very generic function and want a less universal variant of it for convenience.
264264

1-js/06-advanced-functions/12-arrow-functions/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Let's revisit arrow functions.
44

55
Arrow functions are not just a "shorthand" for writing small stuff. They have some very specific and useful features.
66

7-
JavaScript is full of situations where we need to write a small function, that's executed somewhere else.
7+
JavaScript is full of situations where we need to write a small function that's executed somewhere else.
88

99
For instance:
1010

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ There are also methods that limit access to the *whole* object:
316316

317317
[Object.freeze(obj)](mdn:js/Object/freeze)
318318
: Forbids adding/removing/changing of properties. Sets `configurable: false, writable: false` for all existing properties.
319+
319320
And also there are tests for them:
320321

321322
[Object.isExtensible(obj)](mdn:js/Object/isExtensible)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The getter works when `obj.propName` is read, the setter -- when it is assigned.
2727

2828
For instance, we have a `user` object with `name` and `surname`:
2929

30-
```js run
30+
```js
3131
let user = {
3232
name: "John",
3333
surname: "Smith"

1-js/08-prototypes/01-prototype-inheritance/4-hamster-proto/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ alert( lazy.stomach ); // <nothing>
4444

4545
Now all works fine, because `this.stomach=` does not perform a lookup of `stomach`. The value is written directly into `this` object.
4646

47-
Also we can totally evade the problem by making sure that each hamster has their own stomach:
47+
Also we can totally avoid the problem by making sure that each hamster has their own stomach:
4848

4949
```js run
5050
let hamster = {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ Here we have the following inheritance chain: `rabbit` inherits from `animal`, t
308308

309309
Note, there's one funny thing. Where is the method `rabbit.hasOwnProperty` coming from? We did not define it. Looking at the chain we can see that the method is provided by `Object.prototype.hasOwnProperty`. In other words, it's inherited.
310310

311-
...But why `hasOwnProperty` does not appear in `for..in` loop, like `eats` and `jumps`, if it lists all inherited properties.
311+
...But why does `hasOwnProperty` not appear in the `for..in` loop like `eats` and `jumps` do, if `for..in` lists inherited properties?
312312

313-
The answer is simple: it's not enumerable. Just like all other properties of `Object.prototype`, it has `enumerable:false` flag. That's why they are not listed.
313+
The answer is simple: it's not enumerable. Just like all other properties of `Object.prototype`, it has `enumerable:false` flag. And `for..in` only lists enumerable properties. That's why it and the rest of the `Object.prototype` properties are not listed.
314314

315315
```smart header="Almost all other key/value-getting methods ignore inherited properties"
316316
Almost all other key/value-getting methods, such as `Object.keys`, `Object.values` and so on ignore inherited properties.
@@ -324,6 +324,6 @@ They only operate on the object itself. Properties from the prototype are *not*
324324
- We can use `obj.__proto__` to access it (a historical getter/setter, there are other ways, to be covered soon).
325325
- The object referenced by `[[Prototype]]` is called a "prototype".
326326
- If we want to read a property of `obj` or call a method, and it doesn't exist, then JavaScript tries to find it in the prototype.
327-
- Write/delete operations for act directly on the object, they don't use the prototype (assuming it's a data property, not is a setter).
327+
- Write/delete operations act directly on the object, they don't use the prototype (assuming it's a data property, not a setter).
328328
- If we call `obj.method()`, and the `method` is taken from the prototype, `this` still references `obj`. So methods always work with the current object even if they are inherited.
329-
- The `for..in` loop iterates over both own and inherited properties. All other key/value-getting methods only operate on the object itself.
329+
- The `for..in` loop iterates over both its own and its inherited properties. All other key/value-getting methods only operate on the object itself.

1-js/09-classes/04-private-protected-properties-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Supportable
302302
For users, when a new version comes out, it may be a total overhaul internally, but still simple to upgrade if the external interface is the same.
303303

304304
Hiding complexity
305-
: People adore to use things that are simple. At least from outside. What's inside is a different thing.
305+
: People adore using things that are simple. At least from outside. What's inside is a different thing.
306306

307307
Programmers are not an exception.
308308

1-js/10-error-handling/1-try-catch/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Error handling, "try..catch"
22

3-
No matter how great we are at programming, sometimes our scripts have errors. They may occur because of our mistakes, an unexpected user input, an erroneous server response and for a thousand of other reasons.
3+
No matter how great we are at programming, sometimes our scripts have errors. They may occur because of our mistakes, an unexpected user input, an erroneous server response and for a thousand other reasons.
44

55
Usually, a script "dies" (immediately stops) in case of an error, printing it to console.
66

1-js/11-async/05-promise-api/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Here the second promise rejects in two seconds. That leads to immediate rejectio
9494
```warn header="In case of an error, other promises are ignored"
9595
If one promise rejects, `Promise.all` immediately rejects, completely forgetting about the other ones in the list. Their results are ignored.
9696
97-
For example, if there are multiple `fetch` calls, like in the example above, and one fails, other ones will still continue to execute, but `Promise.all` don't watch them any more. They will probably settle, but the result will be ignored.
97+
For example, if there are multiple `fetch` calls, like in the example above, and one fails, other ones will still continue to execute, but `Promise.all` won't watch them anymore. They will probably settle, but the result will be ignored.
9898
9999
`Promise.all` does nothing to cancel them, as there's no concept of "cancellation" in promises. In [another chapter](info:fetch-abort) we'll cover `AbortController` that can help with that, but it's not a part of the Promise API.
100100
```

1-js/13-modules/01-modules-intro/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Build tools do the following:
355355
- Unused exports removed ("tree-shaking").
356356
- Development-specific statements like `console` and `debugger` removed.
357357
- Modern, bleeding-edge JavaScript syntax may be transformed to older one with similar functionality using [Babel](https://babeljs.io/).
358-
- The resulting file is minified (spaces removed, variables replaced with shorter named etc).
358+
- The resulting file is minified (spaces removed, variables replaced with shorter names, etc).
359359
360360
If we use bundle tools, then as scripts are bundled together into a single file (or few files), `import/export` statements inside those scripts are replaced by special bundler functions. So the resulting "bundled" script does not contain any `import/export`, it doesn't require `type="module"`, and we can put it into a regular script:
361361

1-js/13-modules/02-import-export/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ let User = user.default; // the default export
275275
new User('John');
276276
```
277277
278-
### A word agains default exports
278+
### A word against default exports
279279
280280
Named exports are explicit. They exactly name what they import, so we have that information from them, that's a good thing.
281281

4-binary/03-blob/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let blob = new Blob(["<html>…</html>"], {type: 'text/html'});
2929

3030
```js
3131
// create Blob from a typed array and strings
32-
let hello = new Uint8Array([72, 101, 108, 108, 111]); // "hello" in binary form
32+
let hello = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" in binary form
3333

3434
let blob = new Blob([hello, ' ', 'world'], {type: 'text/plain'});
3535
```

6-data-storage/01-cookie/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Cookies are usually set by a web-server using response `Set-Cookie` HTTP-header.
77
One of the most widespread use cases is authentication:
88

99
1. Upon sign in, the server uses `Set-Cookie` HTTP-header in the response to set a cookie with a unique "session identifier".
10-
2. Next time when the request is set to the same domain, the browser sends the over the net using `Cookie` HTTP-header.
10+
2. Next time when the request is set to the same domain, the browser sends the cookie over the net using `Cookie` HTTP-header.
1111
3. So the server knows who made the request.
1212

1313
We can also access cookies from the browser, using `document.cookie` property.

0 commit comments

Comments
 (0)