You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: 1-js/02-first-steps/01-hello-world/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ The `<script>` tag contains JavaScript code which is automatically executed when
46
46
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
47
47
48
48
The `type` attribute: <code><script <u>type</u>=...></code>
49
-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic; we'll talk about modules in another part of the tutorial.
49
+
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic, we'll talk about modules in another part of the tutorial.
50
50
51
51
The `language` attribute: <code><script <u>language</u>=...></code>
52
52
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
Copy file name to clipboardexpand all lines: 1-js/04-object-basics/01-object/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,7 @@ user.likes birds = true
103
103
104
104
JavaScript doesn't understand that. It thinks that we address `user.likes`, and then gives a syntax error when comes across unexpected `birds`.
105
105
106
-
The dot requires the key to be a valid variable identifier. That implies: contains no spaces, doesn't start with a digit and doesn't include special characters (`$`и`_` are allowed).
106
+
The dot requires the key to be a valid variable identifier. That implies: contains no spaces, doesn't start with a digit and doesn't include special characters (`$`and`_` are allowed).
107
107
108
108
There's an alternative "square bracket notation" that works with any string:
Copy file name to clipboardexpand all lines: 1-js/05-data-types/02-number/article.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -324,7 +324,7 @@ Please note that an empty or a space-only string is treated as `0` in all numeri
324
324
325
325
```smart header="Compare with `Object.is`"
326
326
327
-
There is a special built-in method [Object.is](mdn:js/Object/is) that compares values like `===`, but is more reliable for two edge cases:
327
+
There is a special built-in method [`Object.is`](mdn:js/Object/is) that compares values like `===`, but is more reliable for two edge cases:
328
328
329
329
1. It works with `NaN`: `Object.is(NaN, NaN) === true`, that's a good thing.
330
330
2. Values `0` and `-0` are different: `Object.is(0, -0) === false`, technically that's true, because internally the number has a sign bit that may be different even if all other bits are zeroes.
@@ -417,7 +417,7 @@ To write numbers with many zeroes:
417
417
418
418
For different numeral systems:
419
419
420
-
- Can write numbers directly in hex (`0x`), octal (`0o`) and binary (`0b`) systems
420
+
- Can write numbers directly in hex (`0x`), octal (`0o`) and binary (`0b`) systems.
421
421
- `parseInt(str, base)` parses the string `str` into an integer in numeral system with given `base`, `2 ≤ base ≤ 36`.
422
422
- `num.toString(base)` converts a number to a string in the numeral system with the given `base`.
Here we can even more clearer see that there are multiple objects, each one has the `value` and `next` pointing to the neighbour. The `list` variable is the first object in the chain, so following `next` pointers from it we can reach any element.
465
+
Here we can even more clearly see that there are multiple objects, each one has the `value` and `next` pointing to the neighbour. The `list` variable is the first object in the chain, so following `next` pointers from it we can reach any element.
466
466
467
467
The list can be easily split into multiple parts and later joined back:
This way of copying an object is much shorter than `let objCopy = Object.assign({}, obj);` or for an array `let arrCopy = Object.assign([], arr);` so we prefer to use it whenever we can.
271
+
272
+
228
273
## Summary
229
274
230
275
When we see `"..."` in the code, it is either rest parameters or the spread syntax.
Copy file name to clipboardexpand all lines: 1-js/06-advanced-functions/03-closure/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -200,7 +200,7 @@ Rectangles on the right-hand side demonstrate how the global Lexical Environment
200
200
>>>>>>> a0bfa924a17cad8e7fee213904b27dbf57c2dbac
201
201
=======
202
202
1. When the script starts, the Lexical Environment is pre-populated with all declared variables.
203
-
- Initially, they are in the "Uninitialized" state. That's a special internal state, it means that the engine knows about the variable, but won't allow to use it before`let`. It's almost the same as if the variable didn't exist.
203
+
- Initially, they are in the "Uninitialized" state. That's a special internal state, it means that the engine knows about the variable, but it cannot be referenced until it has been declared with`let`. It's almost the same as if the variable didn't exist.
204
204
2. Then `let phrase` definition appears. There's no assignment yet, so its value is `undefined`. We can use the variable since this moment.
Copy file name to clipboardexpand all lines: 2-ui/1-document/11-coordinates/1-find-point-coordinates/solution.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Outer corners
2
2
3
-
Outer corners are basically what we get from [elem.getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/DOM/element.getBoundingClientRect).
3
+
Outer corners are basically what we get from [elem.getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/DOM/element.getBoundingClientRect).
4
4
5
5
Coordinates of the upper-left corner `answer1` and the bottom-right corner `answer2`:
Copy file name to clipboardexpand all lines: 2-ui/2-events/02-bubbling-and-capturing/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -204,7 +204,7 @@ elem.addEventListener("click", e => alert(2));
204
204
205
205
When an event happens -- the most nested element where it happens gets labeled as the "target element" (`event.target`).
206
206
207
-
- Then the event moves down from the document root to `event.target`, calling handlers assigned with `addEventListener(...., true)` on the way (`true` is a shorthand for `{capture: true}`).
207
+
- Then the event moves down from the document root to `event.target`, calling handlers assigned with `addEventListener(..., true)` on the way (`true` is a shorthand for `{capture: true}`).
208
208
- Then handlers are called on the target element itself.
209
209
- Then the event bubbles up from `event.target` up to the root, calling handlers assigned using `on<event>` and `addEventListener` without the 3rd argument or with the 3rd argument `false/{capture:false}`.
Now `dispatchEvent` runs asynchronously after the current code execution is finished, including `mouse.onclick`, so event handlers are totally separate.
Copy file name to clipboardexpand all lines: 2-ui/3-event-details/1-mouse-events-basics/article.md
+3-4
Original file line number
Diff line number
Diff line change
@@ -65,8 +65,8 @@ But if we track `mousedown` and `mouseup`, then we need it, because these events
65
65
There are the three possible values:
66
66
67
67
-`event.which == 1` -- the left button
68
-
-`event.which == 2` - the middle button
69
-
-`event.which == 3` - the right button
68
+
-`event.which == 2` -- the middle button
69
+
-`event.which == 3` -- the right button
70
70
71
71
The middle button is somewhat exotic right now and is very rarely used.
72
72
@@ -116,8 +116,7 @@ For JS-code it means that we should check `if (event.ctrlKey || event.metaKey)`.
116
116
```
117
117
118
118
```warn header="There are also mobile devices"
119
-
Keyboard combinations are good as an addition to the workflow. So that if the visitor has a
120
-
keyboard -- it works. And if their device doesn't have it -- then there should be another way to do the same.
119
+
Keyboard combinations are good as an addition to the workflow. So that if the visitor has a keyboard -- it works. And if their device doesn't have it -- then there should be another way to do the same.
Copy file name to clipboardexpand all lines: 5-network/02-formdata/article.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ let formData = new FormData([form]);
12
12
13
13
If HTML `form` element is provided, it automatically captures its fields.
14
14
15
-
The special thing about `FormData` is that network methods, such as `fetch`, can accept a `FormData` object as a body. It's encoded and sent out with `Content-Type: form/multipart`.
15
+
The special thing about `FormData` is that network methods, such as `fetch`, can accept a `FormData` object as a body. It's encoded and sent out with `Content-Type: multipart/form-data`.
16
16
17
17
From the server point of view, that looks like a usual form submission.
18
18
@@ -81,7 +81,7 @@ for(let [name, value] of formData) {
81
81
82
82
## Sending a form with a file
83
83
84
-
The form is always sent as `Content-Type: form/multipart`, this encoding allows to send files. So, `<input type="file">` fields are sent also, similar to a usual form submission.
84
+
The form is always sent as `Content-Type: multipart/form-data`, this encoding allows to send files. So, `<input type="file">` fields are sent also, similar to a usual form submission.
Copy file name to clipboardexpand all lines: 7-animation/1-bezier-curve/article.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Here are some examples:
50
50
## De Casteljau's algorithm
51
51
52
52
There's a mathematical formula for Bezier curves, but let's cover it a bit later, because
53
-
[De Casteljau's algorithm](https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm)it is identical to the mathematical definition and visually shows how it is constructed.
53
+
[De Casteljau's algorithm](https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm) is identical to the mathematical definition and visually shows how it is constructed.
Copy file name to clipboardexpand all lines: 9-regular-expressions/03-regexp-unicode/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Unicode: flag "u" and class \p{...}
2
2
3
-
JavaScript uses [Unicode encoding](https://en.wikipedia.org/wiki/Unicode) for strings. Most characters are encoding with 2 bytes, but that allows to represent at most 65536 characters.
3
+
JavaScript uses [Unicode encoding](https://en.wikipedia.org/wiki/Unicode) for strings. Most characters are encoded with 2 bytes, but that allows to represent at most 65536 characters.
4
4
5
5
That range is not big enough to encode all possible characters, that's why some rare characters are encoded with 4 bytes, for instance like `𝒳` (mathematical X) or `😄` (a smile), some hieroglyphs and so on.
0 commit comments