Skip to content

Commit 0a8c9fc

Browse files
committed
merging all conflicts
2 parents 76b6892 + e01998b commit 0a8c9fc

File tree

18 files changed

+158
-115
lines changed

18 files changed

+158
-115
lines changed

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if (hour < 10 || hour > 18 || isWeekend) {
6464
}
6565
```
6666

67-
## OR "||" finds the first truthy value
67+
## OR "||" finds the first truthy value [#or-finds-the-first-truthy-value]
6868

6969
The logic described above is somewhat classical. Now, let's bring in the "extra" features of JavaScript.
7070

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ alert('Done!');
318318

319319
We need a way to stop the process if the user cancels the input.
320320

321-
The ordinary `break` after `input` would only break the inner loop. That's not sufficient--labels, come to the rescue!
321+
The ordinary `break` after `input` would only break the inner loop. That's not sufficient -- labels, come to the rescue!
322322

323323
A *label* is an identifier with a colon before a loop:
324324
```js
@@ -363,12 +363,14 @@ Labels do not allow us to jump into an arbitrary place in the code.
363363
364364
For example, it is impossible to do this:
365365
```js
366-
break label; // doesn't jumps to the label below
366+
break label; // jump to the label below (doesn't work)
367367
368368
label: for (...)
369369
```
370370
371-
A call to `break/continue` is only possible from inside a loop and the label must be somewhere above the directive.
371+
A call to `continue` is only possible from inside the loop.
372+
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.
372374
````
373375

374376
## Summary

1-js/04-object-basics/02-object-copy/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ alert( a == b ); // false
100100
101101
For comparisons like `obj1 > obj2` or for a comparison against a primitive `obj == 5`, objects are converted to primitives. We'll study how object conversions work very soon, but to tell the truth, such comparisons are needed very rarely -- usually they appear as a result of a programming mistake.
102102
103-
## Cloning and merging, Object.assign
103+
## Cloning and merging, Object.assign [#cloning-and-merging-object-assign]
104104
105105
So, copying an object variable creates one more reference to the same object.
106106
@@ -186,7 +186,7 @@ let clone = Object.assign({}, user);
186186
187187
It copies all properties of `user` into the empty object and returns it.
188188
189-
There are also other methods of cloning an object, e.g. using the [spread operator](info:rest-parameters-spread) `clone = {...user}`, covered later in the tutorial.
189+
There are also other methods of cloning an object, e.g. using the [spread syntax](info:rest-parameters-spread) `clone = {...user}`, covered later in the tutorial.
190190
191191
## Nested cloning
192192

1-js/05-data-types/02-number/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ There are two ways to do so:
160160
```js run
161161
let num = 1.23456;
162162

163-
alert( Math.floor(num * 100) / 100 ); // 1.23456 -> 123.456 -> 123 -> 1.23
163+
alert( Math.round(num * 100) / 100 ); // 1.23456 -> 123.456 -> 123 -> 1.23
164164
```
165165

166166
2. The method [toFixed(n)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) rounds the number to `n` digits after the point and returns a string representation of the result.

1-js/05-data-types/03-string/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ The characters are compared by their numeric code. The greater code means that t
528528
- All lowercase letters go after uppercase letters because their codes are greater.
529529
- Some letters like `Ö` stand apart from the main alphabet. Here, it's code is greater than anything from `a` to `z`.
530530

531-
### Correct comparisons
531+
### Correct comparisons [#correct-comparisons]
532532

533533
The "right" algorithm to do string comparisons is more complex than it may seem, because alphabets are different for different languages.
534534

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ welcome(); // Hello, Guest (nested call works)
326326

327327
Now it works, because the name `"func"` is function-local. It is not taken from outside (and not visible there). The specification guarantees that it will always reference the current function.
328328

329-
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.
329+
The outer code still has its 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"
332332
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.

1-js/09-classes/03-static-properties-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ That is the same as a direct assignment to `Article`:
125125
Article.publisher = "Ilya Kantor";
126126
```
127127

128-
## Inheritance of static properties and methods
128+
## Inheritance of static properties and methods [#statics-and-inheritance]
129129

130130
Static properties and methods are inherited.
131131

1-js/10-error-handling/1-try-catch/1-finally-or-code-after/solution.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
The difference becomes obvious when we look at the code inside a function.
22

3-
The behavior is different if there's a "jump out" of `try..catch`.
3+
The behavior is different if there's a "jump out" of `try...catch`.
44

5-
For instance, when there's a `return` inside `try..catch`. The `finally` clause works in case of *any* exit from `try..catch`, even via the `return` statement: right after `try..catch` is done, but before the calling code gets the control.
5+
For instance, when there's a `return` inside `try...catch`. The `finally` clause works in case of *any* exit from `try...catch`, even via the `return` statement: right after `try...catch` is done, but before the calling code gets the control.
66

77
```js run
88
function f() {
@@ -11,7 +11,7 @@ function f() {
1111
*!*
1212
return "result";
1313
*/!*
14-
} catch (e) {
14+
} catch (err) {
1515
/// ...
1616
} finally {
1717
alert('cleanup!');
@@ -28,11 +28,11 @@ function f() {
2828
try {
2929
alert('start');
3030
throw new Error("an error");
31-
} catch (e) {
31+
} catch (err) {
3232
// ...
3333
if("can't handle the error") {
3434
*!*
35-
throw e;
35+
throw err;
3636
*/!*
3737
}
3838

1-js/10-error-handling/1-try-catch/1-finally-or-code-after/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ importance: 5
66

77
Compare the two code fragments.
88

9-
1. The first one uses `finally` to execute the code after `try..catch`:
9+
1. The first one uses `finally` to execute the code after `try...catch`:
1010

1111
```js
1212
try {
1313
work work
14-
} catch (e) {
14+
} catch (err) {
1515
handle errors
1616
} finally {
1717
*!*
1818
cleanup the working space
1919
*/!*
2020
}
2121
```
22-
2. The second fragment puts the cleaning right after `try..catch`:
22+
2. The second fragment puts the cleaning right after `try...catch`:
2323

2424
```js
2525
try {
2626
work work
27-
} catch (e) {
27+
} catch (err) {
2828
handle errors
2929
}
3030

0 commit comments

Comments
 (0)