Skip to content

Sync with upstream @ e01998ba #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
bda37e2
Update article.md
Zearin Jan 15, 2021
18417c3
Update article.md
Zearin Jan 16, 2021
8806d5b
Update article.md
Zearin Jan 16, 2021
93b1051
unify content with cosmetic changes
Jan 25, 2021
ad01279
restore try-catch-flow.svg
Jan 25, 2021
b93be73
Update article.md
Zearin Jan 25, 2021
d78ce9c
Update article.md
Zearin Jan 25, 2021
4711ee4
Update article.md
Zearin Jan 25, 2021
7be7b28
Considering Promise.any there are 6 static methods
mikitachyzhyk Feb 2, 2021
f014534
Remove comma after `e.g.` based on feedback
Zearin Feb 2, 2021
0d52720
needed 4 translated repos
joaquinelio Feb 4, 2021
c8a52a1
Add comments to article.md
knoxj1 Feb 4, 2021
ff9e2e2
Merge pull request #1 from knoxj1/knoxj1-patch-1
knoxj1 Feb 4, 2021
dd9833c
Update 2-ui/4-forms-controls/1-form-elements/article.md
knoxj1 Feb 10, 2021
879554f
Update article.md - fix syntax
eucalyptus-viminalis Feb 24, 2021
f6ae0b5
minor fixes
iliakan Feb 28, 2021
f452810
typo
joaquinelio Mar 2, 2021
fdcf507
Fix little formatting typo in 1.2.13 (loops)
T1mL3arn Mar 5, 2021
d9d1023
spread operator vs spread syntax
lumosmind Mar 8, 2021
e6bf25f
Merge pull request #2495 from joaquinelio/info
iliakan Mar 12, 2021
20fd4f8
Merge pull request #2496 from knoxj1/master
iliakan Mar 12, 2021
f267fad
Merge pull request #2504 from fibretothepremises/patch-2
iliakan Mar 12, 2021
7ec4f28
Merge pull request #2507 from joaquinelio/patch-1
iliakan Mar 12, 2021
e0f41ea
Merge pull request #2509 from T1mL3arn/patch-1
iliakan Mar 12, 2021
bf66ad6
Merge pull request #2511 from lumosmind/patch-6
iliakan Mar 12, 2021
a89de35
closes #2498
iliakan Mar 13, 2021
91aed38
minor fixes
iliakan Mar 13, 2021
78f7678
closes #2494
iliakan Mar 13, 2021
e4c769d
Merge pull request #2489 from mikitachyzhyk/patch-1
iliakan Mar 13, 2021
c3a9bbd
minor fixes
iliakan Mar 13, 2021
175574e
Merge pull request #2440 from Zearin/patch-1
iliakan Mar 13, 2021
8bc505a
closes #2459
iliakan Mar 13, 2021
7ad529e
Merge pull request #2464 from VibingCreator/master
iliakan Mar 13, 2021
bbf60dd
minor fixes
iliakan Mar 13, 2021
e01998b
minor fixes
iliakan Mar 14, 2021
035d873
merging all conflicts
iliakan Mar 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/11-logical-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ if (hour < 10 || hour > 18 || isWeekend) {
}
```

<<<<<<< HEAD
## АБО "||" знаходить перше правдиве значення
=======
## OR "||" finds the first truthy value [#or-finds-the-first-truthy-value]
>>>>>>> e01998baf8f85d9d6cef9f1add6c81b901f16d69

Описана вище логіка дещо класична. Тепер давайте введемо "додаткові" особливості JavaScript.

Expand Down
14 changes: 14 additions & 0 deletions 1-js/02-first-steps/13-while-for/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ alert('Готово!');

Нам потрібен спосіб зупинити ці два цикли, якщо користувач скасує введення.

<<<<<<< HEAD
Звичайний `break` після `input` лише перерве внутрішній цикл, а нам цього недостатньо. Ось тут нам пригодяться мітки для циклів!
=======
The ordinary `break` after `input` would only break the inner loop. That's not sufficient -- labels, come to the rescue!
>>>>>>> e01998baf8f85d9d6cef9f1add6c81b901f16d69

*Мітка* складається з ідентифікатора та двокрапки перед циклом:
```js
Expand Down Expand Up @@ -363,12 +367,22 @@ for (let i = 0; i < 3; i++) { ... }

Наприклад, ось таке неможливо зробити:
```js
<<<<<<< HEAD
break label; // не стрибне в мітку label нижче
=======
break label; // jump to the label below (doesn't work)
>>>>>>> e01998baf8f85d9d6cef9f1add6c81b901f16d69

label: for (...)
```

<<<<<<< HEAD
Виклик `break/continue` можливий лише всередині циклу і мітки повинні бути вище цих директив.
=======
A call to `continue` is only possible from inside the loop.

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.
>>>>>>> e01998baf8f85d9d6cef9f1add6c81b901f16d69
````

## Підсумки
Expand Down
4 changes: 2 additions & 2 deletions 1-js/04-object-basics/02-object-copy/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ alert( a == b ); // false

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.

## Cloning and merging, Object.assign
## Cloning and merging, Object.assign [#cloning-and-merging-object-assign]

So, copying an object variable creates one more reference to the same object.

Expand Down Expand Up @@ -186,7 +186,7 @@ let clone = Object.assign({}, user);

It copies all properties of `user` into the empty object and returns it.

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.
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.

## Nested cloning

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/02-number/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ alert( num.toString(2) ); // 11111111
```js run
let num = 1.23456;

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

2. Метод [toFixed(n)](https://developer.mozilla.org/uk/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) округляє число до `n` цифр після точки та повертає рядкове представлення результату.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/03-string/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ The characters are compared by their numeric code. The greater code means that t
- All lowercase letters go after uppercase letters because their codes are greater.
- Some letters like `Ö` stand apart from the main alphabet. Here, it's code is greater than anything from `a` to `z`.

### Correct comparisons
### Correct comparisons [#correct-comparisons]

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

Expand Down
2 changes: 1 addition & 1 deletion 1-js/06-advanced-functions/06-function-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ welcome(); // Hello, Guest (nested call works)

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.

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.
The outer code still has its variable `sayHi` or `welcome`. And `func` is an "internal function name", how the function can call itself internally.

```smart header="There's no such thing for Function Declaration"
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.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/09-classes/03-static-properties-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ That is the same as a direct assignment to `Article`:
Article.publisher = "Ilya Kantor";
```

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

Static properties and methods are inherited.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
The difference becomes obvious when we look at the code inside a function.

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

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.
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.

```js run
function f() {
Expand All @@ -11,7 +11,7 @@ function f() {
*!*
return "result";
*/!*
} catch (e) {
} catch (err) {
/// ...
} finally {
alert('cleanup!');
Expand All @@ -28,11 +28,11 @@ function f() {
try {
alert('start');
throw new Error("an error");
} catch (e) {
} catch (err) {
// ...
if("can't handle the error") {
*!*
throw e;
throw err;
*/!*
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ importance: 5

Compare the two code fragments.

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

```js
try {
work work
} catch (e) {
} catch (err) {
handle errors
} finally {
*!*
cleanup the working space
*/!*
}
```
2. The second fragment puts the cleaning right after `try..catch`:
2. The second fragment puts the cleaning right after `try...catch`:

```js
try {
work work
} catch (e) {
} catch (err) {
handle errors
}

Expand Down
Loading