This commit is contained in:
Ilya Kantor 2019-12-27 11:40:59 +03:00
parent 2483af0eda
commit 994390265a
5 changed files with 19 additions and 20 deletions

View file

@ -140,7 +140,7 @@ for(let value of generator) {
}
```
As generators are iterable, we can call all related functionality, e.g. the spread operator `...`:
As generators are iterable, we can call all related functionality, e.g. the spread syntax `...`:
```js run
function* generateSequence() {
@ -154,7 +154,7 @@ let sequence = [0, ...generateSequence()];
alert(sequence); // 0, 1, 2, 3
```
In the code above, `...generateSequence()` turns the iterable generator object into an array of items (read more about the spread operator in the chapter [](info:rest-parameters-spread-operator#spread-operator))
In the code above, `...generateSequence()` turns the iterable generator object into an array of items (read more about the spread syntax in the chapter [](info:rest-parameters-spread#spread-syntax))
## Using generators for iterables