Array.prototype.at

Returns the element at the given index. If the index is negative, counts back from the last element.

Syntax

at(index)

Parameters

Return value

An array element or undefined.

Example

["coffee", "tea", "juice"].at(1)
"tea"
["coffee", "tea", "juice"].at(-3)
"coffee"