R
fn

remove

v0.0.10tested

Return a new array with the item at `index` removed. Returns a shallow copy unchanged when the index is out of range. Never mutates.

Example

ts
remove(['a', 'b', 'c'], 1); // ['a', 'c']

Signature

ts
export function remove<T>(array: readonly T[], index: number): T[]{ ... }

Type Parameters

T

Parameters

ParameterTypeDescription
arrayreadonly T[]The source array
indexnumberIndex of the item to remove

Returns

T[]A new array without the removed item