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

1-js/09-classes/07-mixins/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,4 @@ Some other languages like allow multiple inheritance. JavaScript does not suppor
205205

206206
We can use mixins as a way to augment a class by multiple behaviors, like event-handling as we have seen above.
207207

208-
Mixins may become a point of conflict if they occasionally overwrite existing class methods. So generally one should think well about the naming methods of a mixin, to minimize the probability of that.
208+
Mixins may become a point of conflict if they accidentally overwrite existing class methods. So generally one should think well about the naming methods of a mixin, to minimize the probability of that.

1-js/99-js-misc/01-proxy/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ As we can see, without any traps, `proxy` is a transparent wrapper around `targe
4343

4444
To activate more capabilities, let's add traps.
4545

46-
What can we intercept by them?
46+
What can we intercept with them?
4747

48-
For most operations on objects, there's a so-called "internal method" in JavaScript specificaiton, that describes on the lowest level, how it works. For instance, `[[Get]]` - the internal method to read a property, `[[Set]]` -- the internal method to write a property, and so on. These methods are only used in the specification, we can't them directly by name.
48+
For most operations on objects, there's a so-called "internal method" in JavaScript specificaiton, that describes on the lowest level, how it works. For instance, `[[Get]]` - the internal method to read a property, `[[Set]]` -- the internal method to write a property, and so on. These methods are only used in the specification, we can't call them directly by name.
4949

5050
Proxy traps inercept invocations of these methods. They are listed in [Proxy specification](https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots) and in the table below.
5151

@@ -99,7 +99,7 @@ It triggers when a property is read, with following arguments:
9999

100100
Let's use `get` to implement default values for an object.
101101

102-
We'll make a numeric array that returns return `0` for non-existant values.
102+
We'll make a numeric array that returns `0` for non-existant values.
103103

104104
Usually when one tries to get a non-existing array item, they get `undefined`, but we'll wrap a regular array into proxy that traps reading and returns `0` if there's no such property:
105105

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/mouseleave.view/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77

88
#child {
9-
background: #CFCE95;
9+
background: #FFDE99;
1010
width: 50%;
1111
height: 50%;
1212
position: absolute;
Loading

0 commit comments

Comments
 (0)