Skip to content

at

Retrieves the element at a specified index in an array, supporting negative indices.

Usage

ts
import { at } from 'rattail'

at([1, 2, 3], 0) // return 1
at([1, 2, 3], -1) // return 3

Arguments

ArgTypeDefaults
arrArray
indexnumber

Return

Type
any