The splice function method in JavaScript is to remove one or more elements from an array, and if necessary, insert a new element at the location of the removed element, returning the element that was removed.
Arrayobj.splice (Start, DeleteCount, [item1[, item2[, ... [, Itemn]]])
Where Arrayobj must be selected. An Array object.
Start is a required option. Specifies the starting position of the element to be removed from the array, which is calculated starting at 0. Www.hrbfkyy120.com
DeleteCount is a mandatory option. The number of elements to remove.
Item1, item2,.. ., Itemn is a must-have option. The new element to insert at the location of the removed element.
The splice function method in JavaScript modifies arrayobj by removing the specified number of elements from the start position and inserting new elements. The return value is a new Array object that consists of the elements that were removed.
Splice functions in JavaScript