remove() Function

Removes the value at a given index from an array, and returns the resulting array.

Syntax

remove( array, index )

array: (Any Type Array) The array to modify.

index: (Integer or Integer Array) The one-based index or array of indices whose values should be removed.

Returns

Any Type Array

Notes

The index value must be greater than or equal to 1.

Passing an empty array to the array parameter returns an empty array.

Passing an empty array to the index parameter returns the original array value.

Examples

You can experiment with this function in the test box below.

Test Input

Remove One Value from an Array:

remove({10, 20, 30, 40}, 4) returns 10, 20, 30

Remove Multiple Values from an Array:

remove({10, 20, 30, 40},{2, 4}) returns 10, 30

Pass an Empty Array of Indices:

remove({10, 20, 30, 40}, {}) returns 10, 20, 30, 40

remove(null, {}) returns null

FEEDBACK