TypeScript Array

13 functions

atarray.at(index: number): T | undefined

Returns the item at the given index (supports negative indices).

Array.fromArray.from(arrayLike, mapFn?): T[]

Creates a new Array instance from an array-like or iterable object.

Array.ofArray.of(...items: T[]): T[]

Creates a new Array instance with a variable number of arguments.

everyarray.every(predicate): boolean

Tests whether all elements in the array pass the provided function.

fillarray.fill(value, start?, end?): T[]

Changes all elements in an array to a static value, from a start index to an end index.

findIndexarray.findIndex(predicate): number

Returns the index of the first element satisfying the provided testing function.

findLastarray.findLast(predicate): T | undefined

Returns the last element satisfying the provided testing function. (ES2023)

findLastIndexarray.findLastIndex(predicate): number

Returns the index of the last element satisfying the provided testing function. (ES2023)

flatarray.flat(depth?): T[]

Creates a new array with all sub-array elements concatenated recursively up to the specified depth.

flatMaparray.flatMap(mapFn): T[]

Returns a new array formed by applying a given callback function to each element, then flattening the result by one level.

includesarray.includes(value, fromIndex?): boolean

Determines whether an array includes a certain value among its entries.

somearray.some(predicate): boolean

Tests whether at least one element in the array passes the provided function.

structuredClonestructuredClone<T>(value: T): T

Creates a deep clone of the given value.