...

/

Iterators and Destructuring

Iterators and Destructuring

destructuring using iterators and their behavior

We'll cover the following...

When equating an array to an iterable, iteration takes place.

Press + to interact
let lampIterator = getLampIterator();
let [head,] = lampIterator;
console.log( head, [...lampIterator] );
//> red []

The destructuring assignment is executed as follows:

...