Skip to content

Commit 65e9233

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-8c30654f
2 parents 117a192 + 8c30654 commit 65e9233

File tree

27 files changed

+50
-41
lines changed

27 files changed

+50
-41
lines changed

1-js/03-code-quality/01-debugging-chrome/article.md

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

33
Before writing more complex code, let's talk about debugging.
44

5-
[Debugging](https://en.wikipedia.org/wiki/Debugging) is the process of finding and fixing errors within a script. All modern browsers and most other environments support debugging tools -- a special UI in developer tools that enable debugging much easier. It also allows to trace the code step by step to see what exactly is going on.
5+
[Debugging](https://en.wikipedia.org/wiki/Debugging) is the process of finding and fixing errors within a script. All modern browsers and most other environments support debugging tools -- a special UI in developer tools that makes debugging much easier. It also allows to trace the code step by step to see what exactly is going on.
66

77
We'll be using Chrome here, because it has enough features, most other browsers have a similar process`.
88

1-js/03-code-quality/02-coding-style/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let n = prompt("n?", "");
2626
2727
if (n < 0) {
2828
alert(`Power ${n} is not supported,
29-
please enter an integer number, greater than 0`);
29+
please enter a non-negative integer number`);
3030
} else {
3131
alert( pow(x, n) );
3232
}

1-js/03-code-quality/02-coding-style/code-style.svg

Lines changed: 1 addition & 1 deletion
Loading

1-js/03-code-quality/05-testing-mocha/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Automated testing with mocha
1+
# Automated testing with Mocha
22

33
Automated testing will be used in further tasks, and it's also widely used in real projects.
44

1-js/04-object-basics/03-symbol/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ alert(id); // TypeError: Cannot convert a Symbol value to a string
5050
*/!*
5151
```
5252
53-
That's a "language guard" against messing up, because strings and symbols are fundamentally different and should not occasionally convert one into another.
53+
That's a "language guard" against messing up, because strings and symbols are fundamentally different and should not accidentally convert one into another.
5454
5555
If we really want to show a symbol, we need to explicitly call `.toString()` on it, like here:
5656
```js run
@@ -72,7 +72,7 @@ alert(id.description); // id
7272

7373
## "Hidden" properties
7474

75-
Symbols allow us to create "hidden" properties of an object, that no other part of code can occasionally access or overwrite.
75+
Symbols allow us to create "hidden" properties of an object, that no other part of code can accidentally access or overwrite.
7676

7777
For instance, if we're working with `user` objects, that belong to a third-party code. We'd like to add identifiers to them.
7878

@@ -92,7 +92,7 @@ alert( user[id] ); // we can access the data using the symbol as the key
9292

9393
What's the benefit of using `Symbol("id")` over a string `"id"`?
9494

95-
As `user` objects belongs to another code, and that code also works with them, we shouldn't just add any fields to it. That's unsafe. But a symbol cannot be accessed occasionally, the third-party code probably won't even see it, so it's probably all right to do.
95+
As `user` objects belongs to another code, and that code also works with them, we shouldn't just add any fields to it. That's unsafe. But a symbol cannot be accessed accidentally, the third-party code probably won't even see it, so it's probably all right to do.
9696

9797
Also, imagine that another script wants to have its own identifier inside `user`, for its own purposes. That may be another JavaScript library, so that the scripts are completely unaware of each other.
9898

@@ -284,7 +284,7 @@ Symbols are always different values, even if they have the same name. If we want
284284
Symbols have two main use cases:
285285

286286
1. "Hidden" object properties.
287-
If we want to add a property into an object that "belongs" to another script or a library, we can create a symbol and use it as a property key. A symbolic property does not appear in `for..in`, so it won't be occasionally processed together with other properties. Also it won't be accessed directly, because another script does not have our symbol. So the property will be protected from occasional use or overwrite.
287+
If we want to add a property into an object that "belongs" to another script or a library, we can create a symbol and use it as a property key. A symbolic property does not appear in `for..in`, so it won't be accidentally processed together with other properties. Also it won't be accessed directly, because another script does not have our symbol. So the property will be protected from accidental use or overwrite.
288288

289289
So we can "covertly" hide something into objects that we need, but others should not see, using symbolic properties.
290290

1-js/04-object-basics/05-object-toprimitive/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ For instance:
196196
}
197197
};
198198
199-
alert(obj + 2); // 22 (ToPrimitive returned string => concatenation)
199+
alert(obj + 2); // 22 (conversion to primitive returned a string => concatenation)
200200
```
201201

202202
## Summary

1-js/05-data-types/05-array-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ arr.slice(start, end)
124124

125125
It returns a new array copying to it all items from index `start` to `end` (not including `end`). Both `start` and `end` can be negative, in that case position from array end is assumed.
126126

127-
It's similar to a string method `str.slice`, but instead of substringss it makes subarrays.
127+
It's similar to a string method `str.slice`, but instead of substrings it makes subarrays.
128128

129129
For instance:
130130

1-js/05-data-types/10-destructuring-assignment/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ In real-life, the problem is how to remember the order of arguments. Usually IDE
428428
Like this?
429429
430430
```js
431-
// undefined where detauls values are fine
431+
// undefined where default values are fine
432432
showMenu("My Menu", undefined, undefined, ["Item1", "Item2"])
433433
```
434434

1-js/05-data-types/12-json/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,13 @@ The first call is special. It is made using a special "wrapper object": `{"": me
286286
The idea is to provide as much power for `replacer` as possible: it has a chance to analyze and replace/skip even the whole object if necessary.
287287

288288

289-
## Formatting: spacer
289+
## Formatting: space
290290

291-
The third argument of `JSON.stringify(value, replacer, spaces)` is the number of spaces to use for pretty formatting.
291+
The third argument of `JSON.stringify(value, replacer, space)` is the number of spaces to use for pretty formatting.
292292

293-
Previously, all stringified objects had no indents and extra spaces. That's fine if we want to send an object over a network. The `spacer` argument is used exclusively for a nice output.
293+
Previously, all stringified objects had no indents and extra spaces. That's fine if we want to send an object over a network. The `space` argument is used exclusively for a nice output.
294294

295-
Here `spacer = 2` tells JavaScript to show nested objects on multiple lines, with indentation of 2 spaces inside an object:
295+
Here `space = 2` tells JavaScript to show nested objects on multiple lines, with indentation of 2 spaces inside an object:
296296

297297
```js run
298298
let user = {
@@ -328,7 +328,7 @@ alert(JSON.stringify(user, null, 2));
328328
*/
329329
```
330330

331-
The `spaces` parameter is used solely for logging and nice-output purposes.
331+
The `space` parameter is used solely for logging and nice-output purposes.
332332

333333
## Custom "toJSON"
334334

1-js/06-advanced-functions/01-recursion/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ As we can see, when our function gets a department to sum, there are two possibl
337337
338338
The 1st case is the base of recursion, the trivial case, when we get an array.
339339
340-
The 2nd case when we gen an object is the recursive step. A complex task is split into subtasks for smaller departments. They may in turn split again, but sooner or later the split will finish at (1).
340+
The 2nd case when we get an object is the recursive step. A complex task is split into subtasks for smaller departments. They may in turn split again, but sooner or later the split will finish at (1).
341341
342342
The algorithm is probably even easier to read from the code:
343343

0 commit comments

Comments
 (0)