Skip to content

Commit 59a4159

Browse files
authored
Merge pull request #222 from javascript-tutorial/sync-4d01fc20
Sync with upstream @ 4d01fc2
2 parents e1e22e5 + 34e3622 commit 59a4159

File tree

9 files changed

+20
-21
lines changed

9 files changed

+20
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Let's examine the `for` statement part-by-part:
106106

107107
| part | | |
108108
|-------|----------|----------------------------------------------------------------------------|
109-
| begin | `i = 0` | Executes once upon entering the loop. |
109+
| begin | `let i = 0` | Executes once upon entering the loop. |
110110
| condition | `i < 3`| Checked before every loop iteration. If false, the loop stops. |
111111
| body | `alert(i)`| Runs again and again while the condition is truthy. |
112112
| step| `i++` | Executes after the body on each iteration. |

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In modern JavaScript, there are two types of numbers:
44

55
1. Regular numbers in JavaScript are stored in 64-bit format [IEEE-754](https://en.wikipedia.org/wiki/IEEE_754-2008_revision), also known as "double precision floating point numbers". These are numbers that we're using most of the time, and we'll talk about them in this chapter.
66

7-
2. BigInt numbers, to represent integers of arbitrary length. They are sometimes needed, because a regular number can't exceed <code>2<sup>53</sup></code> or be less than <code>-2<sup>53</sup></code>. As bigints are used in few special areas, we devote them a special chapter <info:bigint>.
7+
2. BigInt numbers, to represent integers of arbitrary length. They are sometimes needed, because a regular number can't safely exceed <code>2<sup>53</sup></code> or be less than <code>-2<sup>53</sup></code>. As bigints are used in few special areas, we devote them a special chapter <info:bigint>.
88

99
So here we'll talk about regular numbers. Let's expand our knowledge of them.
1010

@@ -53,7 +53,7 @@ Just like before, using `"e"` can help. If we'd like to avoid writing the zeroes
5353
let ms = 1e-6; // six zeroes to the left from 1
5454
```
5555

56-
If we count the zeroes in `0.000001`, there are 6 of them. So naturally it's `1e-6`.
56+
If we count the zeroes in `0.000001`, there are 6 of them. So naturally it's `1e-6`.
5757

5858
In other words, a negative number after `"e"` means a division by 1 with the given number of zeroes:
5959

@@ -329,7 +329,7 @@ let num = +prompt("Enter a number", '');
329329
alert( isFinite(num) );
330330
```
331331

332-
Please note that an empty or a space-only string is treated as `0` in all numeric functions including `isFinite`.
332+
Please note that an empty or a space-only string is treated as `0` in all numeric functions including `isFinite`.
333333

334334
```smart header="Compare with `Object.is`"
335335

1-js/06-advanced-functions/04-var/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
```smart header="This article is for understanding old scripts"
55
The information in this article is useful for understanding old scripts.
66
7-
That's not how we write a new code.
7+
That's not how we write new code.
88
```
99

1010
In the very first chapter about [variables](info:variables), we mentioned three ways of variable declaration:

1-js/07-object-properties/01-property-descriptors/article.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ We didn't see them yet, because generally they do not show up. When we create a
1919

2020
First, let's see how to get those flags.
2121

22-
The method [Object.getOwnPropertyDescriptor](mdn:js/Object/getOwnPropertyDescriptor) allows to query the *full* information about a property.
22+
The method [Object.getOwnPropertyDescriptor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor) allows to query the *full* information about a property.
2323

2424
The syntax is:
2525
```js
@@ -54,7 +54,7 @@ alert( JSON.stringify(descriptor, null, 2 ) );
5454
*/
5555
```
5656

57-
To change the flags, we can use [Object.defineProperty](mdn:js/Object/defineProperty).
57+
To change the flags, we can use [Object.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty).
5858

5959
The syntax is:
6060

@@ -275,7 +275,7 @@ We can change `writable: true` to `false` for a non-configurable property, thus
275275

276276
## Object.defineProperties
277277

278-
There's a method [Object.defineProperties(obj, descriptors)](mdn:js/Object/defineProperties) that allows to define many properties at once.
278+
There's a method [Object.defineProperties(obj, descriptors)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties) that allows to define many properties at once.
279279

280280
The syntax is:
281281

@@ -301,7 +301,7 @@ So, we can set many properties at once.
301301

302302
## Object.getOwnPropertyDescriptors
303303

304-
To get all property descriptors at once, we can use the method [Object.getOwnPropertyDescriptors(obj)](mdn:js/Object/getOwnPropertyDescriptors).
304+
To get all property descriptors at once, we can use the method [Object.getOwnPropertyDescriptors(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors).
305305

306306
Together with `Object.defineProperties` it can be used as a "flags-aware" way of cloning an object:
307307

@@ -327,24 +327,24 @@ Property descriptors work at the level of individual properties.
327327

328328
There are also methods that limit access to the *whole* object:
329329

330-
[Object.preventExtensions(obj)](mdn:js/Object/preventExtensions)
330+
[Object.preventExtensions(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions)
331331
: Forbids the addition of new properties to the object.
332332

333-
[Object.seal(obj)](mdn:js/Object/seal)
333+
[Object.seal(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal)
334334
: Forbids adding/removing of properties. Sets `configurable: false` for all existing properties.
335335

336-
[Object.freeze(obj)](mdn:js/Object/freeze)
336+
[Object.freeze(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze)
337337
: Forbids adding/removing/changing of properties. Sets `configurable: false, writable: false` for all existing properties.
338338

339339
And also there are tests for them:
340340

341-
[Object.isExtensible(obj)](mdn:js/Object/isExtensible)
341+
[Object.isExtensible(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible)
342342
: Returns `false` if adding properties is forbidden, otherwise `true`.
343343

344-
[Object.isSealed(obj)](mdn:js/Object/isSealed)
344+
[Object.isSealed(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed)
345345
: Returns `true` if adding/removing properties is forbidden, and all existing properties have `configurable: false`.
346346

347-
[Object.isFrozen(obj)](mdn:js/Object/isFrozen)
347+
[Object.isFrozen(obj)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen)
348348
: Returns `true` if adding/removing/changing properties is forbidden, and all current properties are `configurable: false, writable: false`.
349349

350350
These methods are rarely used in practice.

1-js/11-async/03-promise-chaining/article.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ function loadJson(url) {
332332
}
333333

334334
function loadGithubUser(name) {
335-
return fetch(`https://api.github.com/users/${name}`)
336-
.then(response => response.json());
335+
return loadJson(`https://api.github.com/users/${name}`);
337336
}
338337

339338
function showAvatar(githubUser) {

2-ui/4-forms-controls/3-events-change-input/1-deposit-calculator/solution.view/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
let years = form.months.value / 12;
9797
if (!years) return;
9898

99-
let result = Math.round(initial * (1 + interest * years));
99+
let result = Math.round(initial * (1 + interest) ** years);
100100

101101
let height = result / form.money.value * 100 + 'px';
102102
document.getElementById('height-after').style.height = height;

2-ui/4-forms-controls/3-events-change-input/1-deposit-calculator/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ The formula is:
1717
// initial: the initial money sum
1818
// interest: e.g. 0.05 means 5% per year
1919
// years: how many years to wait
20-
let result = Math.round(initial * (1 + interest * years));
20+
let result = Math.round(initial * (1 + interest) ** years);
2121
```

2-ui/4-forms-controls/3-events-change-input/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ For instance, the code below prevents all such events and shows what we are tryi
6464

6565
Please note, that it's possible to copy/paste not just text, but everything. For instance, we can copy a file in the OS file manager, and paste it.
6666

67-
That's because `clipboardData` implements `DataTransfer` interface, commonly used for drag'n'drop and copy/pasting. It's bit beyound our scope now, but you can find its methods [in the specification](https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface).
67+
That's because `clipboardData` implements `DataTransfer` interface, commonly used for drag'n'drop and copy/pasting. It's bit beyond our scope now, but you can find its methods [in the specification](https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface).
6868

6969
```warn header="ClipboardAPI: user safety restrictions"
7070
The clipboard is a "global" OS-level thing. So most browsers allow read/write access to the clipboard only in the scope of certain user actions for the safety, e.g. in `onclick` event handlers.

7-animation/2-css-animations/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ A propriedade `transform` é uma grande escolha, porque:
433433

434434
Por outras palavras, o navegador calcula a Layout (tamanhos, posições), pinta-a com cores, fundo, etc no estágio Paint, e depois aplica `transform` a caixas de elementos que precisarem.
435435

436-
Mudanças (animações) da propriedade `transform` nunca desencadeiam os passos Layout e Paint. E ainda mais, o navegador explora o acelerador de gráficos (um *chip* especial na *CPU* ou placa gráfica) para transformações CSS, tornando-as muito eficientes.
436+
Mudanças (animações) da propriedade `transform` nunca desencadeiam os passos Layout e Paint. E ainda mais, o navegador explora o acelerador de gráficos (um *chip* especial na *CPU* ou placa gráfica) para transformações CSS, tornando-as assim muito eficientes.
437437

438438
Felizmente, a propriedade `transform` é muito poderosa. Ao usar `transform` em um elemento, você pode rodá-lo e virá-lo, esticá-lo e encolhê-lo, deslocá-lo, e [muito mais](https://developer.mozilla.org/pt-BR/docs/Web/CSS/transform), Assim, em vez das propriedades `left/margin-left` nós podemos usar `transform: translateX(…)`, usar `transform: scale` para aumentar o tamanho de um elemento, etc.
439439

0 commit comments

Comments
 (0)