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/03-code-quality/06-polyfills/article.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Teams behind JavaScript engines have their own ideas about what to implement fir
7
7
8
8
So it's quite common for an engine to implement only part of the standard.
9
9
10
-
A good page to see the current state of support for language features is <https://kangax.github.io/compat-table/es6/> (it's big, we have a lot to study yet).
10
+
A good page to see the current state of support for language features is <https://compat-table.github.io/compat-table/es6/> (it's big, we have a lot to study yet).
11
11
12
12
As programmers, we'd like to use most recent features. The more good stuff - the better!
13
13
@@ -85,7 +85,7 @@ Just don't forget to use a transpiler (if using modern syntax or operators) and
85
85
For example, later when you're familiar with JavaScript, you can setup a code build system based on [webpack](https://webpack.js.org/) with the [babel-loader](https://github.com/babel/babel-loader) plugin.
86
86
87
87
Good resources that show the current state of support for various features:
88
-
- <https://kangax.github.io/compat-table/es6/> - for pure JavaScript.
88
+
- <https://compat-table.github.io/compat-table/es6/> - for pure JavaScript.
89
89
- <https://caniuse.com/> - for browser-related functions.
90
90
91
91
P.S. Google Chrome is usually the most up-to-date with language features, try it if a tutorial demo fails. Most tutorial demos work with any modern browser though.
Copy file name to clipboardExpand all lines: 1-js/05-data-types/10-destructuring-assignment/article.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,18 @@ The two most used data structures in JavaScript are `Object` and `Array`.
5
5
- Objects allow us to create a single entity that stores data items by key.
6
6
- Arrays allow us to gather data items into an ordered list.
7
7
8
-
However, when we pass those to a function, it may need not to be an object/array as a whole. It may need individual pieces.
8
+
However, when we pass these to a function, we may not need all of it. The function might only require certain elements or properties.
9
9
10
10
*Destructuring assignment* is a special syntax that allows us to "unpack" arrays or objects into a bunch of variables, as sometimes that's more convenient.
11
11
12
-
Destructuring also works great with complex functions that have a lot of parameters, default values, and so on. Soon we'll see that.
12
+
Destructuring also works well with complex functions that have a lot of parameters, default values, and so on. Soon we'll see that.
13
13
14
14
## Array destructuring
15
15
16
16
Here's an example of how an array is destructured into variables:
17
17
18
18
```js
19
-
// we have an array with the name and surname
19
+
// we have an array with a name and surname
20
20
let arr = ["John", "Smith"]
21
21
22
22
*!*
@@ -40,10 +40,10 @@ alert(firstName); // John
40
40
alert(surname); // Smith
41
41
```
42
42
43
-
As you can see, the syntax is simple. There are several peculiar details though. Let's see more examples, to better understand it.
43
+
As you can see, the syntax is simple. There are several peculiar details though. Let's see more examples to understand it better.
44
44
45
45
````smart header="\"Destructuring\" does not mean \"destructive\"."
46
-
It's called "destructuring assignment," because it "destructurizes" by copying items into variables. But the array itself is not modified.
46
+
It's called "destructuring assignment," because it "destructurizes" by copying items into variables. However, the array itself is not modified.
47
47
48
48
It's just a shorter way to write:
49
49
```js
@@ -65,7 +65,7 @@ let [firstName, , title] = ["Julius", "Caesar", "Consul", "of the Roman Republic
65
65
alert( title ); // Consul
66
66
```
67
67
68
-
In the code above, the second element of the array is skipped, the third one is assigned to `title`, and the rest of the array items is also skipped (as there are no variables for them).
68
+
In the code above, the second element of the array is skipped, the third one is assigned to `title`, and the rest of the array items are also skipped (as there are no variables for them).
69
69
````
70
70
71
71
````smart header="Works with any iterable on the right-side"
@@ -95,17 +95,17 @@ alert(user.surname); // Smith
95
95
````
96
96
97
97
````smart header="Looping with .entries()"
98
-
In the previous chapter we saw the [Object.entries(obj)](mdn:js/Object/entries) method.
98
+
In the previous chapter, we saw the [Object.entries(obj)](mdn:js/Object/entries) method.
99
99
100
-
We can use it with destructuring to loop over keys-and-values of an object:
100
+
We can use it with destructuring to loop over the keys-and-values of an object:
101
101
102
102
```js run
103
103
let user = {
104
104
name: "John",
105
105
age: 30
106
106
};
107
107
108
-
// loop over keys-and-values
108
+
// loop over the keys-and-values
109
109
*!*
110
110
for (let [key, value] of Object.entries(user)) {
111
111
*/!*
@@ -169,7 +169,7 @@ If we'd like also to gather all that follows -- we can add one more parameter th
169
169
let [name1, name2, *!*...rest*/!*] = ["Julius", "Caesar", *!*"Consul", "of the Roman Republic"*/!*];
170
170
171
171
*!*
172
-
// rest is array of items, starting from the 3rd one
172
+
// rest is an array of items, starting from the 3rd one
173
173
alert(rest[0]); // Consul
174
174
alert(rest[1]); // of the Roman Republic
175
175
alert(rest.length); // 2
@@ -187,7 +187,7 @@ let [name1, name2, *!*...titles*/!*] = ["Julius", "Caesar", "Consul", "of the Ro
187
187
188
188
### Default values
189
189
190
-
If the array is shorter than the list of variables at the left, there'll be no errors. Absent values are considered undefined:
190
+
If the array is shorter than the list of variables on the left, there will be no errors. Absent values are considered undefined:
Copy file name to clipboardExpand all lines: 1-js/08-prototypes/04-prototype-methods/article.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ The only usage of `__proto__`, that's not frowned upon, is as a property when cr
14
14
15
15
Although, there's a special method for this too:
16
16
17
-
-[Object.create(proto, [descriptors])](mdn:js/Object/create) -- creates an empty object with given `proto` as `[[Prototype]]` and optional property descriptors.
17
+
-[Object.create(proto[, descriptors])](mdn:js/Object/create) -- creates an empty object with given `proto` as `[[Prototype]]` and optional property descriptors.
Copy file name to clipboardExpand all lines: 7-animation/2-css-animations/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -463,7 +463,7 @@ The `opacity` property also never triggers Layout (also skips Paint in Mozilla G
463
463
464
464
Paring `transform` with `opacity` can usually solve most of our needs, providing fluid, good-looking animations.
465
465
466
-
For example, here clicking on the `#boat` element adds the class with `transform: translateX(300)` and `opacity: 0`, thus making it move `300px` to the right and disappear:
466
+
For example, here clicking on the `#boat` element adds the class with `transform: translateX(300px)` and `opacity: 0`, thus making it move `300px` to the right and disappear:
Copy file name to clipboardExpand all lines: 7-animation/3-js-animation/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -452,4 +452,4 @@ Surely we could improve it, add more bells and whistles, but JavaScript animatio
452
452
453
453
JavaScript animations can use any timing function. We covered a lot of examples and transformations to make them even more versatile. Unlike CSS, we are not limited to Bezier curves here.
454
454
455
-
The same is about `draw`: we can animate anything, not just CSS properties.
455
+
The same is true about `draw`: we can animate anything, not just CSS properties.
0 commit comments