Removes the element startIndex, or the elements from startIndex to (but not including) endIndex, from the array.
startIndex
endIndex
Negative indices count backwards from the end of the array. If index is fractional or otherwise invalid, returns a shallow copy of the array.
index
This function removes elements by indices. To remove by element value, use reject.
import * as A from "flurp/array";const removeSecond = A.remove(1);removeSecond([10, 20, 30, 40]); // [10, 30, 40]const removeLast = A.remove(-1);removeLast([10, 20, 30, 40]); // [10, 20, 30]const removeSecondAndThird = A.remove(2, 4);removeSecondAndThird([10, 20, 30, 40]); // [10, 40]
Optional
Removes the element
startIndex
, or the elements fromstartIndex
to (but not including)endIndex
, from the array.Negative indices count backwards from the end of the array. If
index
is fractional or otherwise invalid, returns a shallow copy of the array.Remarks
This function removes elements by indices. To remove by element value, use reject.
Example