Skip to content

Commit ce8304b

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-97ef8624
2 parents 96342b3 + 97ef862 commit ce8304b

File tree

11 files changed

+13
-15
lines changed

11 files changed

+13
-15
lines changed

1-js/02-first-steps/08-operators/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Here's a more complex example:
104104
alert(2 + 2 + '1' ); // "41" and not "221"
105105
```
106106
107-
Here, operators work one after another. The first `+` sums two numbers, so it returns `4`, then the next `+` adds the string `1` to it, so it's like `4 + '1' = 41`.
107+
Here, operators work one after another. The first `+` sums two numbers, so it returns `4`, then the next `+` adds the string `1` to it, so it's like `4 + '1' = '41'`.
108108

109109
```js run
110110
alert('1' + 2 + 2); // "122" and not "14"

1-js/02-first-steps/14-switch/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ switch (a) {
4747
break;
4848
*/!*
4949
case 5:
50-
alert( 'Too large' );
50+
alert( 'Too big' );
5151
break;
5252
default:
5353
alert( "I don't know such values" );

1-js/03-code-quality/06-polyfills/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A good page to see the current state of support for language features is <https:
1111

1212
As programmers, we'd like to use most recent features. The more good stuff - the better!
1313

14-
From the other hand, how to make out modern code work on older engines that don't understand recent features yet?
14+
On the other hand, how to make our modern code work on older engines that don't understand recent features yet?
1515

1616
There are two tools for that:
1717

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ This operator has no special treatment for arrays, it works with them as with an
438438
Let's recall the rules:
439439

440440
- Two objects are equal `==` only if they're references to the same object.
441-
- If one of arguments of `==` is an object, and the other one is a primitive, then the object gets converted to primitive, as explained in the chapter <info:object-toprimitive>.
441+
- If one of the arguments of `==` is an object, and the other one is a primitive, then the object gets converted to primitive, as explained in the chapter <info:object-toprimitive>.
442442
- ...With an exception of `null` and `undefined` that equal `==` each other and nothing else.
443443

444444
The strict comparison `===` is even simpler, as it doesn't convert types.
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
function topSalary(salaries) {
22

3-
let max = 0;
3+
let maxSalary = 0;
44
let maxName = null;
55

66
for(const [name, salary] of Object.entries(salaries)) {
77
if (max < salary) {
8-
max = salary;
8+
maxSalary = salary;
99
maxName = name;
1010
}
1111
}
1212

1313
return maxName;
14-
}
15-
16-
14+
}

1-js/09-classes/01-class/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ user.sayHi();
5151

5252
When `new User("John")` is called:
5353
1. A new object is created.
54-
2. The `constructor` runs with the given argument and assigns `this.name` to it.
54+
2. The `constructor` runs with the given argument and assigns it to `this.name`.
5555

5656
...Then we can call methods, such as `user.sayHi`.
5757

1-js/09-classes/02-class-inheritance/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rabbit.run(5); // White Rabbit runs with speed 5.
5555
rabbit.hide(); // White Rabbit hides!
5656
```
5757

58-
Object of `Rabbit` class have access to both `Rabbit` methods, such as `rabbit.hide()`, and also to `Animal` methods, such as `rabbit.run()`.
58+
Object of `Rabbit` class have access both to `Rabbit` methods, such as `rabbit.hide()`, and also to `Animal` methods, such as `rabbit.run()`.
5959

6060
Internally, `extends` keyword works using the good old prototype mechanics. It sets `Rabbit.prototype.[[Prototype]]` to `Animal.prototype`. So, if a method is not found in `Rabbit.prototype`, JavaScript takes it from `Animal.prototype`.
6161

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ let sayMixin = {
7070
};
7171

7272
let sayHiMixin = {
73-
__proto__: sayMixin, // (or we could use Object.create to set the prototype here)
73+
__proto__: sayMixin, // (or we could use Object.setPrototypeOf to set the prototype here)
7474

7575
sayHi() {
7676
*!*

9-regular-expressions/13-regexp-alternation/03-match-quoted-string/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ The solution: `pattern:/"(\\.|[^"\\])*"/g`.
33
Step by step:
44

55
- First we look for an opening quote `pattern:"`
6-
- Then if we have a backslash `pattern:\\` (we technically have to double it in the pattern, because it is a special character, so that's a single backslash in fact), then any character is fine after it (a dot).
6+
- Then if we have a backslash `pattern:\\` (we have to double it in the pattern because it is a special character), then any character is fine after it (a dot).
77
- Otherwise we take any character except a quote (that would mean the end of the string) and a backslash (to prevent lonely backslashes, the backslash is only used with some other symbol after it): `pattern:[^"\\]`
88
- ...And so on till the closing quote.
99

9-regular-expressions/14-regexp-lookahead-lookbehind/1-find-non-negative-integers/solution.md

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

22
The regexp for an integer number is `pattern:\d+`.
33

4-
We can exclude negatives by prepending it with the negative lookahead: `pattern:(?<!-)\d+`.
4+
We can exclude negatives by prepending it with the negative lookbehind: `pattern:(?<!-)\d+`.
55

66
Although, if we try it now, we may notice one more "extra" result:
77

0 commit comments

Comments
 (0)