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/04-object-basics/01-object/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
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:
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-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ Here's a little bit longer code:
182
182
Rectangles on the right-hand side demonstrate how the global Lexical Environment changes during the execution:
183
183
184
184
1. When the script starts, the Lexical Environment is pre-populated with all declared variables.
185
-
- 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.
185
+
- 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.
186
186
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-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
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
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,9 +186,9 @@ There's a property `event.eventPhase` that tells us the number of the phase on w
186
186
187
187
The event handling process:
188
188
189
-
-When an event happens -- the most nested element where it happens gets labeled as the "target element" (`event.target`).
190
-
- Then the event first moves from the document root down to the `event.target`, calling handlers assigned with `addEventListener(...., true)` on the way.
191
-
- Then the event moves 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`.
189
+
-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}`).
190
+
- Then handlers are called on the target element itself.
191
+
- 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}`.
192
192
193
193
Each handler can access `event` object properties:
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-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
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.
0 commit comments