Enumerates the sequence while exposing the zero-based index alongside each element.
Type of elements within the source iterable.
source
The source iterable.
A sequence of [index, element] tuples.
[index, element]
The index is assigned in the order elements are produced. Enumeration is deferred until the result is iterated.
const letters = ['a', 'b', 'c'];const indexed = index(letters).toArray();console.log(indexed); // [[0, 'a'], [1, 'b'], [2, 'c']] Copy
const letters = ['a', 'b', 'c'];const indexed = index(letters).toArray();console.log(indexed); // [[0, 'a'], [1, 'b'], [2, 'c']]
Enumerates the sequence while exposing the zero-based index alongside each element.