Skip to content

Commit 453a42f

Browse files
authored
Merge pull request #216 from javascript-tutorial/sync-7b761858
Sync with upstream @ 7b76185
2 parents f017b6b + 8147267 commit 453a42f

File tree

19 files changed

+177
-119
lines changed

19 files changed

+177
-119
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,21 @@ alert( 8 % 3 ); // 2, a remainder of 8 divided by 3
5656

5757
### Exponentiation **
5858

59-
The exponentiation operator `a ** b` multiplies `a` by itself `b` times.
59+
The exponentiation operator `a ** b` raises `a` to the power of `b`.
60+
61+
In school maths, we write that as a<sup>b</sup>.
6062

6163
For instance:
6264

6365
```js run
64-
alert( 2 ** 2 ); // 4 (2 multiplied by itself 2 times)
65-
alert( 2 ** 3 ); // 8 (2 * 2 * 2, 3 times)
66-
alert( 2 ** 4 ); // 16 (2 * 2 * 2 * 2, 4 times)
66+
alert( 2 ** 2 ); // 2² = 4
67+
alert( 2 ** 3 ); // 2³ = 8
68+
alert( 2 ** 4 ); // 2⁴ = 16
6769
```
6870

69-
Mathematically, the exponentiation is defined for non-integer numbers as well. For example, a square root is an exponentiation by `1/2`:
71+
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
72+
73+
For example, a square root is an exponentiation by ½:
7074

7175
```js run
7276
alert( 4 ** (1/2) ); // 2 (power of 1/2 is the same as a square root)

1-js/02-first-steps/13-while-for/article.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,18 @@ break label; // jump to the label below (doesn't work)
368368
label: for (...)
369369
```
370370
371-
A call to `continue` is only possible from inside the loop.
371+
A `break` directive must be inside a code block. Technically, any labelled code block will do, e.g.:
372+
```js
373+
label: {
374+
// ...
375+
break label; // works
376+
// ...
377+
}
378+
```
379+
380+
...Although, 99.9% of the time `break` used is inside loops, as we've seen in the examples above.
372381
373-
The `break` directive may be placed before code blocks too, as `label: { ... }`, but it's almost never used like that. And it also works only inside-out.
382+
A `continue` is only possible from inside a loop.
374383
````
375384

376385
## Summary

1-js/02-first-steps/15-function-basics/2-rewrite-function-question-or/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ function checkAge(age) {
1414
}
1515
```
1616

17-
Note that the parentheses around `age > 18` are not required here. They exist for better readabilty.
17+
Note that the parentheses around `age > 18` are not required here. They exist for better readability.

1-js/02-first-steps/17-arrow-functions-basics/1-rewrite-arrow/solution.md

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

22
```js run
33
function ask(question, yes, no) {
4-
if (confirm(question)) yes()
4+
if (confirm(question)) yes();
55
else no();
66
}
77

1-js/02-first-steps/17-arrow-functions-basics/1-rewrite-arrow/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Replace Function Expressions with arrow functions in the code below:
55

66
```js run
77
function ask(question, yes, no) {
8-
if (confirm(question)) yes()
8+
if (confirm(question)) yes();
99
else no();
1010
}
1111

1-js/05-data-types/08-weakmap-weakset/01-recipients-read/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ messages.shift();
2525
// now readMessages has 1 element (technically memory may be cleaned later)
2626
```
2727

28-
The `WeakSet` allows to store a set of messages and easily check for the existance of a message in it.
28+
The `WeakSet` allows to store a set of messages and easily check for the existence of a message in it.
2929

3030
It cleans up itself automatically. The tradeoff is that we can't iterate over it, can't get "all read messages" from it directly. But we can do it by iterating over all messages and filtering those that are in the set.
3131

1-js/05-data-types/11-date/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ let time1 = 0;
348348
let time2 = 0;
349349

350350
*!*
351-
// run bench(upperSlice) and bench(upperLoop) each 10 times alternating
351+
// run bench(diffSubtract) and bench(diffGetTime) each 10 times alternating
352352
for (let i = 0; i < 10; i++) {
353353
time1 += bench(diffSubtract);
354354
time2 += bench(diffGetTime);

1-js/06-advanced-functions/03-closure/10-make-army/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ Let's examine what exactly happens inside `makeArmy`, and the solution will beco
8888
8989
Here `let j = i` declares an "iteration-local" variable `j` and copies `i` into it. Primitives are copied "by value", so we actually get an independent copy of `i`, belonging to the current loop iteration.
9090
91-
The shooters work correctly, because the value of `i` now lives a little bit closer. Not in `makeArmy()` Lexical Environment, but in the Lexical Environment that corresponds the current loop iteration:
91+
The shooters work correctly, because the value of `i` now lives a little bit closer. Not in `makeArmy()` Lexical Environment, but in the Lexical Environment that corresponds to the current loop iteration:
9292
9393
![](lexenv-makearmy-while-fixed.svg)
9494
95-
Such problem could also be avoided if we used `for` in the beginning, like this:
95+
Such a problem could also be avoided if we used `for` in the beginning, like this:
9696
9797
```js run demo
9898
function makeArmy() {

1-js/06-advanced-functions/03-closure/7-let-scope/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The code above demonstrates it.
2727
function func() {
2828
*!*
2929
// the local variable x is known to the engine from the beginning of the function,
30-
// but "unitialized" (unusable) until let ("dead zone")
30+
// but "uninitialized" (unusable) until let ("dead zone")
3131
// hence the error
3232
*/!*
3333

1-js/06-advanced-functions/03-closure/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Despite being simple, slightly modified variants of that code have practical use
146146

147147
How does this work? If we create multiple counters, will they be independent? What's going on with the variables here?
148148

149-
Undestanding such things is great for the overall knowledge of JavaScript and beneficial for more complex scenarios. So let's go a bit in-depth.
149+
Understanding such things is great for the overall knowledge of JavaScript and beneficial for more complex scenarios. So let's go a bit in-depth.
150150

151151
## Lexical Environment
152152

0 commit comments

Comments
 (0)