Skip to content

Commit 246ec37

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-4d01fc20
2 parents d7d7a69 + 4d01fc2 commit 246ec37

File tree

10 files changed

+20
-21
lines changed

10 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

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

275275
## Object.defineProperties
276276

277-
There's a method [Object.defineProperties(obj, descriptors)](mdn:js/Object/defineProperties) that allows to define many properties at once.
277+
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.
278278

279279
The syntax is:
280280

@@ -300,7 +300,7 @@ So, we can set many properties at once.
300300

301301
## Object.getOwnPropertyDescriptors
302302

303-
To get all property descriptors at once, we can use the method [Object.getOwnPropertyDescriptors(obj)](mdn:js/Object/getOwnPropertyDescriptors).
303+
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).
304304

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

@@ -326,24 +326,24 @@ Property descriptors work at the level of individual properties.
326326

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

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

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

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

338338
And also there are tests for them:
339339

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

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

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

349349
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
@@ -76,7 +76,7 @@ For instance, the code below prevents all such events and shows what we are tryi
7676

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

79-
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).
79+
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).
8080

8181
```warn header="ClipboardAPI: user safety restrictions"
8282
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 @@ The `transform` property is a great choice, because:
433433

434434
In other words, the browser calculates the Layout (sizes, positions), paints it with colors, backgrounds, etc at the Paint stage, and then applies `transform` to element boxes that need it.
435435

436-
Changes (animations) of the `transform` property never trigger Layout and Paint steps. More than that, the browser leverages the graphics accelerator (a special chip on the CPU or graphics card) for CSS transforms, thus making them very effecient.
436+
Changes (animations) of the `transform` property never trigger Layout and Paint steps. More than that, the browser leverages the graphics accelerator (a special chip on the CPU or graphics card) for CSS transforms, thus making them very efficient.
437437

438438
Luckily, the `transform` property is very powerful. By using `transform` on an element, you could rotate and flip it, stretch and shrink it, move it around, and [much more](https://developer.mozilla.org/docs/Web/CSS/transform#syntax). So instead of `left/margin-left` properties we can use `transform: translateX(…)`, use `transform: scale` for increasing element size, etc.
439439

figures.sketch

121 KB
Binary file not shown.

0 commit comments

Comments
 (0)