Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
9bae8fd
Typos
peachesontour Sep 21, 2020
2b8354b
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
7c12746
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
74526b4
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
e0db058
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
ed497e7
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
2be35c9
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
443af20
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
f25dca8
Update 7-animation/2-css-animations/article.md
peachesontour Sep 22, 2020
6c37da4
Update 7-animation/2-css-animations/article.md
peachesontour Sep 23, 2020
5168eaa
Update 7-animation/2-css-animations/article.md
peachesontour Sep 23, 2020
689392e
Fix my typos in 1.5.5
vsemozhetbyt Oct 11, 2020
104bee3
Clarify a bit ambiguous wording in 1.5.7
vsemozhetbyt Oct 12, 2020
7faa49e
Symmetrize Map and Set summaries
vsemozhetbyt Oct 12, 2020
154bf02
Fix possible typo in 1.5.7 task
vsemozhetbyt Oct 12, 2020
0be77b0
Clarify some things in 1.5.12
vsemozhetbyt Oct 15, 2020
6df0982
FIX: minor typo error
leviding Nov 13, 2020
806e371
Update article.md
leviding Nov 13, 2020
fb43e39
Update article.md
leviding Nov 13, 2020
d977582
Update article.md
leviding Nov 13, 2020
ee2bc1c
Update article.md
leviding Nov 13, 2020
26d449c
Minor grammar alteration.
joneskj55 Nov 13, 2020
7a67741
Update article.md
leviding Nov 15, 2020
75e10e2
Update article.md
leviding Nov 15, 2020
cb62d6d
Update article.md
leviding Nov 15, 2020
a39f437
Update article.md
leviding Nov 15, 2020
5b63e81
Update article.md
leviding Nov 15, 2020
358c389
Update article.md
leviding Nov 15, 2020
80eb70f
Update article.md
leviding Nov 15, 2020
adf83c6
Update article.md
leviding Nov 15, 2020
9b3b10f
Update README.md
leviding Nov 16, 2020
6db57d9
Update article.md
leviding Nov 16, 2020
891495c
Promise.any
lumosmind Nov 17, 2020
15780b3
Update task.md
leviding Nov 17, 2020
a81bb4a
Fix typo in 2.2.5 (Dispatching custom events)
vsemozhetbyt Nov 17, 2020
149f63e
FIX: minor typo error, missing "alert( "
leviding Nov 18, 2020
1ba96d4
missssing
joaquinelio Nov 18, 2020
5aeb8fe
Update article.md
leviding Nov 18, 2020
ee8f6d1
Update article.md
joaquinelio Nov 18, 2020
3709b0b
Update article.md
leviding Nov 18, 2020
cd052d1
Update article.md
leviding Nov 18, 2020
0437d57
Fix typo in 2.3.3 (Moving the mouse...)
vsemozhetbyt Nov 18, 2020
5e9937a
Rephrase sentence.
odsantos Nov 18, 2020
0b401e6
Updated article.md
patrikbego Nov 19, 2020
565fef8
Include missing fileServer
manjufy Nov 19, 2020
fa4b19e
Rephrased for better clarity.
patrikbego Nov 19, 2020
1feed09
Rephrased for clarity.
patrikbego Nov 19, 2020
e289aba
Update 1-js/11-async/05-promise-api/article.md
lumosmind Nov 20, 2020
0bdacaf
Fis typo in 2.5.2 (Scripts: async, defer)
vsemozhetbyt Nov 22, 2020
3cb134f
Merge pull request #2307 from vsemozhetbyt/patch-11
iliakan Nov 23, 2020
bd44850
fix nested markdown
joaquinelio Nov 24, 2020
1e590d6
Merge pull request #2310 from joaquinelio/patch-3
iliakan Nov 24, 2020
58136cb
Update article.md
paroche Nov 24, 2020
dcb3758
Merge pull request #2311 from javascript-tutorial/paroche-patch-20
paroche Nov 24, 2020
865c329
Further minor changes to punctuation and wording
paroche Nov 24, 2020
ac92672
And a little more
paroche Nov 24, 2020
54378cb
Correct subhead in 3.1 (Popups and window methods)
vsemozhetbyt Nov 24, 2020
246c6c4
Merge branch 'master' into patch-1
iliakan Nov 24, 2020
501adfd
Merge pull request #2187 from vsemozhetbyt/patch-1
iliakan Nov 24, 2020
c066fea
Merge pull request #2191 from vsemozhetbyt/patch-2
iliakan Nov 24, 2020
50a20d1
Merge pull request #2298 from manjufy/patch-1
iliakan Nov 24, 2020
f7b2208
Fix typo in 2.3.1 (Mouse events)
vsemozhetbyt Nov 17, 2020
b7a7e68
Fix typo in 2.99.2 (Selection and Range)
vsemozhetbyt Nov 23, 2020
a9d2363
Merge pull request #2296 from odsantos/update-strings
iliakan Nov 24, 2020
dd02130
Merge pull request #2295 from vsemozhetbyt/patch-10
iliakan Nov 24, 2020
aacdf01
Merge pull request #2192 from vsemozhetbyt/patch-3
iliakan Nov 24, 2020
7211729
Merge pull request #2193 from vsemozhetbyt/patch-4
iliakan Nov 24, 2020
445d2c8
minor fixes
iliakan Nov 24, 2020
79710c4
Update article.md
patrikbego Nov 24, 2020
50c3e3d
Merge pull request #2199 from vsemozhetbyt/patch-6
iliakan Nov 25, 2020
9700f82
Merge pull request #2283 from leviding/patch-31
iliakan Nov 25, 2020
47ca608
Update README.md
iliakan Nov 25, 2020
31d9441
Update README.md
iliakan Nov 25, 2020
865174e
Merge pull request #2285 from joneskj55/patch-1
iliakan Nov 25, 2020
b8fb9d4
Merge pull request #2300 from patrikbego/patch-1
iliakan Nov 25, 2020
a2494a7
Merge pull request #2290 from vsemozhetbyt/patch-7
iliakan Nov 25, 2020
fbe2050
Merge pull request #2291 from vsemozhetbyt/patch-8
iliakan Nov 25, 2020
ba277aa
Merge pull request #2292 from joaquinelio/patch-2
iliakan Nov 25, 2020
0e79e06
example is fixed and summary is extended
lumosmind Nov 25, 2020
5f04058
Summary section is fixed
lumosmind Nov 25, 2020
2554d3d
Merge pull request #2293 from leviding/patch-33
iliakan Nov 25, 2020
b73c2a4
typo
lumosmind Nov 25, 2020
947afdd
Merge pull request #2297 from patrikbego/patch-2
iliakan Nov 25, 2020
36c0702
Merge pull request #2309 from vsemozhetbyt/patch-11
iliakan Nov 25, 2020
b3974b3
Merge pull request #2313 from vsemozhetbyt/patch-12
iliakan Nov 25, 2020
193e174
Fix possible typos in 4.1 (ArrayBuffer, binary arrays)
vsemozhetbyt Nov 25, 2020
a0b0d43
Merge pull request #2315 from vsemozhetbyt/patch-1
iliakan Nov 25, 2020
0eef950
minor fixes
iliakan Nov 25, 2020
0ac7894
minor fixes
iliakan Nov 25, 2020
fee6657
minor fixes
iliakan Nov 25, 2020
6ec4c4f
minor fixes
iliakan Nov 25, 2020
91da65d
Fix typos in 4.3 (Blob)
vsemozhetbyt Nov 25, 2020
2793f33
Fix typo in 5.2 (FormData)
vsemozhetbyt Nov 26, 2020
ae6f990
Add missing parenthesis in 5.6 (Fetch API)
vsemozhetbyt Nov 27, 2020
b79964a
Fix typos in 5.8 (XMLHttpRequest)
vsemozhetbyt Nov 28, 2020
513d36e
Expand a note in 5.8 (XMLHttpRequest)
vsemozhetbyt Nov 28, 2020
0f0a0c5
Replace deprecated property in 5.9 (Resumable file upload)
vsemozhetbyt Nov 28, 2020
c828fe3
Fix typo in 5.11 (WebSocket)
vsemozhetbyt Nov 29, 2020
e558805
fixes #2326
iliakan Nov 29, 2020
d2ebb42
Merge pull request #2288 from lumosmind/patch-54
iliakan Nov 29, 2020
b852cfe
Update article.md
joaquinelio Nov 29, 2020
ebd774d
Update 7-animation/2-css-animations/article.md
iliakan Nov 29, 2020
00f138c
Merge pull request #2140 from peachesontour/patch-14
iliakan Nov 29, 2020
6f7d9cf
minor fixes
iliakan Nov 29, 2020
8e6ace0
Merge pull request #2325 from vsemozhetbyt/patch-7
iliakan Nov 29, 2020
59c5400
Merge pull request #2324 from vsemozhetbyt/p5.9
iliakan Nov 29, 2020
277374f
Merge pull request #2323 from vsemozhetbyt/patch-6
iliakan Nov 29, 2020
4697b7b
Merge pull request #2322 from vsemozhetbyt/patch-5
iliakan Nov 29, 2020
8b98721
Merge pull request #2321 from vsemozhetbyt/patch-4
iliakan Nov 29, 2020
d05bbe0
Merge pull request #2320 from vsemozhetbyt/patch-3
iliakan Nov 29, 2020
574dd84
closes #2319
iliakan Nov 29, 2020
361c702
Merge pull request #2316 from vsemozhetbyt/patch-2
iliakan Nov 29, 2020
9065fd3
Merge pull request #2302 from patrikbego/patch-3
iliakan Nov 29, 2020
e1a3f63
Merge pull request #2327 from joaquinelio/patch-4
iliakan Nov 29, 2020
cc31d26
merging all conflicts
iliakan Nov 30, 2020
ffa0401
Resolve conflicts/Change tanslations
odsantos Nov 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ Ferramentas modernas tornam a transpilação muito rápida e transparente, permi
Exemplos de tais linguagens:

- [CoffeeScript](http://coffeescript.org/) é um "açúcar sintático" para JavaScript. Ele introduz uma sintaxe mais curta, permitindo-nos escrever um código mais claro e preciso. Normalmente, Ruby devs gostam dele.
- [TypeScript](http://www.typescriptlang.org/) está concentrado em adicionar "dados estritos de digitação" para simplificar o desenvolvimento e suporte de sistemas complexos. É desenvolvido pela Microsoft.
- [Flow](http://flow.org/) também adiciona dados de digitação, mas de uma forma diferente. Desenvolvido pela Facebook.
- [Dart](https://www.dartlang.org/) é uma linguagem autônoma que tem seu próprio mecanismo que roda em ambientes sem navegador (como aplicativos móveis), mas também pode ser transpilada para JavaScript. Desenvolvido pela Google.
- [TypeScript](http://www.typescriptlang.org/) está concentrado em adicionar "estritos tipos de dados" para simplificar o desenvolvimento e suporte de sistemas complexos. É desenvolvido pela Microsoft.
- [Flow](http://flow.org/) também adiciona tipos de dados, mas de uma forma diferente. Desenvolvido pela Facebook.
- [Dart](https://www.dartlang.org/) é uma linguagem autônoma que tem seu próprio interpretador que roda em ambientes fora do navegador (como aplicativos móveis), mas também pode ser transpilada para JavaScript. Desenvolvido pela Google.
- [Brython](https://brython.info/) é um transpilador de Python para JavaScript que permite escrever aplicativos em puro Python, sem JavaScript.

Há mais. Claro que, mesmo que usemos uma dessas linguagens transpiladas, também devemos saber JavaScript para entender o que estamos fazendo.
Expand Down
46 changes: 23 additions & 23 deletions 1-js/04-object-basics/02-object-copy/article.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Object references and copying

One of the fundamental differences of objects versus primitives is that objects are stored and copied "by reference", as opposed to primitive values: strings, numbers, booleans, etc -- that are always copied "as a whole value".
One of the fundamental differences of objects versus primitives is that objects are stored and copied "by reference", whereas primitive values: strings, numbers, booleans, etc -- are always copied "as a whole value".

That's easy to understand if we look a bit "under a cover" of what happens when we copy a value.
That's easy to understand if we look a bit under the hood of what happens when we copy a value.

Let's start with a primitive, such as a string.

Expand All @@ -13,17 +13,17 @@ let message = "Hello!";
let phrase = message;
```

As a result we have two independent variables, each one is storing the string `"Hello!"`.
As a result we have two independent variables, each one storing the string `"Hello!"`.

![](variable-copy-value.svg)

Quite an obvious result, right?

Objects are not like that.

**A variable assigned to an object stores not the object itself, but its "address in memory", in other words "a reference" to it.**
**A variable assigned to an object stores not the object itself, but its "address in memory" -- in other words "a reference" to it.**

Let's look at an example of such variable:
Let's look at an example of such a variable:

```js
let user = {
Expand All @@ -37,13 +37,13 @@ And here's how it's actually stored in memory:

The object is stored somewhere in memory (at the right of the picture), while the `user` variable (at the left) has a "reference" to it.

We may think of an object variable, such as `user`, as of a sheet of paper with the address.
We may think of an object variable, such as `user`, as like a sheet of paper with the address of the object on it.

When we perform actions with the object, e.g. take a property `user.name`, JavaScript engine looks into that address and performs the operation on the actual object.
When we perform actions with the object, e.g. take a property `user.name`, the JavaScript engine looks at what's at that address and performs the operation on the actual object.

Now here's why it's important.

**When an object variable is copied -- the reference is copied, the object is not duplicated.**
**When an object variable is copied, the reference is copied, but the object itself is not duplicated.**

For instance:

Expand All @@ -53,13 +53,13 @@ let user = { name: "John" };
let admin = user; // copy the reference
```

Now we have two variables, each one with the reference to the same object:
Now we have two variables, each storing a reference to the same object:

![](variable-copy-reference.svg)

As you can see, there's still one object, now with two variables that reference it.
As you can see, there's still one object, but now with two variables that reference it.

We can use any variable to access the object and modify its contents:
We can use either variable to access the object and modify its contents:

```js run
let user = { name: 'John' };
Expand All @@ -73,7 +73,7 @@ admin.name = 'Pete'; // changed by the "admin" reference
alert(*!*user.name*/!*); // 'Pete', changes are seen from the "user" reference
```

It's just as if we had a cabinet with two keys and used one of them (`admin`) to get into it. Then, if we later use another key (`user`) we can see changes.
It's as if we had a cabinet with two keys and used one of them (`admin`) to get into it and make changes. Then, if we later use another key (`user`), we are still opening the same cabinet and can access the changed contents.

## Comparison by reference

Expand All @@ -98,15 +98,15 @@ let b = {}; // two independent objects
alert( a == b ); // false
```

For comparisons like `obj1 > obj2` or for a comparison against a primitive `obj == 5`, objects are converted to primitives. We'll study how object conversions work very soon, but to tell the truth, such comparisons are needed very rarely, usually they appear as a result of a programming mistake.
For comparisons like `obj1 > obj2` or for a comparison against a primitive `obj == 5`, objects are converted to primitives. We'll study how object conversions work very soon, but to tell the truth, such comparisons are needed very rarely -- usually they appear as a result of a programming mistake.

## Cloning and merging, Object.assign

So, copying an object variable creates one more reference to the same object.

But what if we need to duplicate an object? Create an independent copy, a clone?

That's also doable, but a little bit more difficult, because there's no built-in method for that in JavaScript. Actually, that's rarely needed. Copying by reference is good most of the time.
That's also doable, but a little bit more difficult, because there's no built-in method for that in JavaScript. But there is rarely a need -- copying by reference is good most of the time.

But if we really want that, then we need to create a new object and replicate the structure of the existing one by iterating over its properties and copying them on the primitive level.

Expand Down Expand Up @@ -225,12 +225,12 @@ user.sizes.width++; // change a property from one place
alert(clone.sizes.width); // 51, see the result from the other one
```

To fix that, we should use the cloning loop that examines each value of `user[key]` and, if it's an object, then replicate its structure as well. That is called a "deep cloning".
To fix that, we should use a cloning loop that examines each value of `user[key]` and, if it's an object, then replicate its structure as well. That is called a "deep cloning".

We can use recursion to implement it. Or, not to reinvent the wheel, take an existing implementation, for instance [_.cloneDeep(obj)](https://lodash.com/docs#cloneDeep) from the JavaScript library [lodash](https://lodash.com).
We can use recursion to implement it. Or, to not reinvent the wheel, take an existing implementation, for instance [_.cloneDeep(obj)](https://lodash.com/docs#cloneDeep) from the JavaScript library [lodash](https://lodash.com).

```smart header="Const objects can be modified"
An important "side effect" of storing objects as references is that an object declared as `const` *can* be modified.
````smart header="Const objects can be modified"
An important side effect of storing objects as references is that an object declared as `const` *can* be modified.

For instance:

Expand All @@ -246,16 +246,16 @@ user.name = "Pete"; // (*)
alert(user.name); // Pete
```

It might seem that the line `(*)` would cause an error, but no. The value of `user` is constant, it must always reference the same object. But properties of that object are free to change.
It might seem that the line `(*)` would cause an error, but it does not. The value of `user` is constant, it must always reference the same object, but properties of that object are free to change.

In other words, the `const user` gives an error only if we try to set `user=...` as a whole, and that's all.
In other words, the `const user` gives an error only if we try to set `user=...` as a whole.

That said, if we really need to make constant object properties, it's also possible, but using totally different methods, we'll mention that in the chapter <info:property-descriptors>.
```
That said, if we really need to make constant object properties, it's also possible, but using totally different methods. We'll mention that in the chapter <info:property-descriptors>.
````

## Summary

Objects are assigned and copied by reference. In other words, a variable stores not the "object value", but a "reference" (address in memory) for the value. So copying such a variable or passing it as a function argument copies that reference, not the object.
Objects are assigned and copied by reference. In other words, a variable stores not the "object value", but a "reference" (address in memory) for the value. So copying such a variable or passing it as a function argument copies that reference, not the object itself.

All operations via copied references (like adding/removing properties) are performed on the same single object.

Expand Down
6 changes: 3 additions & 3 deletions 1-js/04-object-basics/07-optional-chaining/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The optional chaining `?.` is a safe way to access nested object properties, eve

If you've just started to read the tutorial and learn JavaScript, maybe the problem hasn't touched you yet, but it's quite common.

As an example, let's say we have `user` objects that hold the information about our users.
As an example, let's say we have `user` objects that hold the information about our users.

Most of our users have addresses in `user.address` property, with the street `user.address.street`, but some did not provide them.

Expand All @@ -21,7 +21,7 @@ let user = {}; // a user without "address" property
alert(user.address.street); // Error!
```

That's the expected result. JavaScript works like this. As `user.address` is `undefined`, an attempt to get `user.address.street` fails with an error.
That's the expected result. JavaScript works like this. As `user.address` is `undefined`, an attempt to get `user.address.street` fails with an error.

In many practical cases we'd prefer to get `undefined` instead of an error here (meaning "no street").

Expand Down Expand Up @@ -56,7 +56,7 @@ let user = {}; // user has no address
alert(user.address ? user.address.street ? user.address.street.name : null : null);
```

That's just awful, one may even have problems understanding such code.
That's just awful, one may even have problems understanding such code.

Don't even care to, as there's a better way to write it, using the `&&` operator:

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/03-string/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ alert( str.indexOf('widget') ); // -1, not found, the search is case-sensitive
alert( str.indexOf("id") ); // 1, "id" is found at the position 1 (..idget with id)
```

The optional second parameter allows us to search starting from the given position.
The optional second parameter allows us to start searching from a given position.

For instance, the first occurrence of `"id"` is at position `1`. To look for the next occurrence, let's start the search from position `2`:

Expand Down
4 changes: 2 additions & 2 deletions 1-js/05-data-types/05-array-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,8 @@ These methods are the most used ones, they cover 99% of use cases. But there are
- [arr.some(fn)](mdn:js/Array/some)/[arr.every(fn)](mdn:js/Array/every) check the array.

The function `fn` is called on each element of the array similar to `map`. If any/all results are `true`, returns `true`, otherwise `false`.
These methods behave sort of like `||` and `&&` operators: if `fn` returns a truthy value, `arr.some()` immediately returns `true` and stops iterating over the rest items; if `fn` returns a falsy value, `arr.every()` immediately returns `false` and stops iterating over the rest items as well.

These methods behave sort of like `||` and `&&` operators: if `fn` returns a truthy value, `arr.some()` immediately returns `true` and stops iterating over the rest of items; if `fn` returns a falsy value, `arr.every()` immediately returns `false` and stops iterating over the rest of items as well.

We can use `every` to compare arrays:
```js run
Expand Down
16 changes: 9 additions & 7 deletions 1-js/05-data-types/06-iterable/article.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Iterables

*Iterable* objects is a generalization of arrays. That's a concept that allows us to make any object useable in a `for..of` loop.
*Iterable* objects are a generalization of arrays. That's a concept that allows us to make any object useable in a `for..of` loop.

Of course, Arrays are iterable. But there are many other built-in objects, that are iterable as well. For instance, Strings are iterable also. As we'll see, many built-in operators and methods rely on them.

Expand All @@ -26,7 +26,7 @@ let range = {
// for(let num of range) ... num=1,2,3,4,5
```

To make the `range` iterable (and thus let `for..of` work) we need to add a method to the object named `Symbol.iterator` (a special built-in symbol just for that).
To make the `range` object iterable (and thus let `for..of` work) we need to add a method to the object named `Symbol.iterator` (a special built-in symbol just for that).

1. When `for..of` starts, it calls that method once (or errors if not found). The method must return an *iterator* -- an object with the method `next`.
2. Onward, `for..of` works *only with that returned object*.
Expand Down Expand Up @@ -140,7 +140,7 @@ for (let char of str) {

## Calling an iterator explicitly

Normally, internals of iterables are hidden from the external code. There's a `for..of` loop, that works, that's all it needs to know.
For deeper understanding, let's see how to use an iterator explicitly.

We'll iterate over a string in exactly the same way as `for..of`, but with direct calls. This code creates a string iterator and gets values from it "manually":

Expand All @@ -165,14 +165,16 @@ That is rarely needed, but gives us more control over the process than `for..of`

## Iterables and array-likes [#array-like]

There are two official terms that look similar, but are very different. Please make sure you understand them well to avoid the confusion.
Two official terms look similar, but are very different. Please make sure you understand them well to avoid the confusion.

- *Iterables* are objects that implement the `Symbol.iterator` method, as described above.
- *Array-likes* are objects that have indexes and `length`, so they look like arrays.

Naturally, these properties can combine. For instance, strings are both iterable (`for..of` works on them) and array-like (they have numeric indexes and `length`).
When we use JavaScript for practical tasks in a browser or any other environment, we may meet objects that are iterables or array-likes, or both.

But an iterable may be not array-like. And vice versa an array-like may be not iterable.
For instance, strings are both iterable (`for..of` works on them) and array-like (they have numeric indexes and `length`).

But an iterable may not be array-like. And vice versa an array-like may not be iterable.

For example, the `range` in the example above is iterable, but not array-like, because it does not have indexed properties and `length`.

Expand Down Expand Up @@ -291,7 +293,7 @@ alert( str.slice(1, 3) ); // garbage (two pieces from different surrogate pairs)
Objects that can be used in `for..of` are called *iterable*.

- Technically, iterables must implement the method named `Symbol.iterator`.
- The result of `obj[Symbol.iterator]()` is called an *iterator*. It handles the further iteration process.
- The result of `obj[Symbol.iterator]()` is called an *iterator*. It handles further iteration process.
- An iterator must have the method named `next()` that returns an object `{done: Boolean, value: any}`, here `done:true` denotes the end of the iteration process, otherwise the `value` is the next value.
- The `Symbol.iterator` method is called automatically by `for..of`, but we also can do it directly.
- Built-in iterables like strings or arrays, also implement `Symbol.iterator`.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/07-map-set/03-iterable-keys/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ importance: 5

# Iterable keys

We'd like to get an array of `map.keys()` in a variable and then do apply array-specific methods to it, e.g. `.push`.
We'd like to get an array of `map.keys()` in a variable and then apply array-specific methods to it, e.g. `.push`.

But that doesn't work:

Expand Down
Loading