JavaScript array.at() Function

JavaScript Logo

array.at() – Returns the element at the given index. Supports negative indexing.

๐Ÿ‘‰ Syntax

element = array.at(index);

๐Ÿงช Example

const arr=['a','b','c']; arr.at(-1); // 'c'

Comments