Skip to content

at ​

获取 数组 中指定索引的元素,支持负索引。

使用 ​

ts
import { at } from 'rattail'

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

参数 ​

参数类型默认值
arrArray
indexnumber

返回值 ​

类型
any