This article mainly introduces how to use the splice () method in JavaScript. It is the basic knowledge in JS learning. If you need it, you can refer to the splice () method of JavaScript array to change the content of the array, new elements are added and the old elements are eliminated.
Syntax
array.splice(index, howMany, [element1][, ..., elementN]);
The following is the detailed information about the parameters:
Index: the array that changes at the beginning of the index.
How: integer, indicating that the number of elements in the old array is removed. If the howmany value is 0, no elements are deleted.
Element1,..., elementN: add the element to the array. If no element is specified, you only need to delete the elements in the array.
Return Value:
Returns the input-based parameter extraction array.
Example:
JavaScript Array splice Method