Array.splice

Array.splice

Array.splice

Function

Removes the specified range from the array and inserts new elements.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
startIntNo0The index to start deletion; a negative number means counting backwards from the tail.
delete_countIntNofrom start to endNumber of elements to delete; negative numbers are treated as 0.
valueNAnyNoNoneThe new element to insert.

Return value

TypeDescription
ArrayReturns a new array consisting of deleted elements.

Example

Notes

  • This method will modify the original array.