Array.prototype.keys

Returns an iterable of keys (indices) in the array.

Syntax

keys()

Return value

An iterable of keys.

Example

[...["tea", "coffee", "juice"].keys()]
[0, 1, 2]