Equana

Docs/Arrays/enumerate
Back to Arrays

enumerate

Pair each element with its 1-based index.

Syntax

enumerate(arr) → Array of (index, element) tuples

Backends

TypeScript

Description

Pair each element with its 1-based index.

Parameters

NameDescription
arrInput array

Returns

Array of (index, element) tuples

Examples

Try It
>> enumerate(["a", "b"])
[(1, "a"), (2, "b")]

See Also