Use compiler option '--downlevelIteration' to allow iterating of iterators. 1

Use compiler option ‘–downlevelIteration’ to allow iterating of iterators.

Array.from(Array(3).keys())

Here is what the above code is Doing:
1. Array.from() creates a new array from an array-like or iterable object.
2. Array(3) creates an array with 3 empty slots, [ , , ].
3. .keys() creates a new Array Iterator object that contains the keys for each index in the array.
4. Array.from() creates a new array from the Array Iterator, [0, 1, 2].

Similar Posts