Skip to content

delete

Returns a copy of the array without the item at the provided index. The original array is not mutated because the implementation uses toSpliced, making it suitable for immutable state updates in UI code.

Usage

ts
const values = ['draft', 'published', 'archived'];
const nextValues = values.delete(1);

// ['draft', 'archived']

Parameters

NameTypeDescription
indexnumberIndex to remove.

Returns

A new array without the item at index.

Type signature

ts
interface Array<T> {
    delete(index: number): T[];
}

All packages are released under the MIT License.