Original article: http://www.cnblogs.com/web-ed2/archive/2011/07/20/2111678.html
Definition
Splice () methodThe element used to insert, delete, or replace an array.
The slice () method can extract a part of a string and return the extracted part with a new string.
Usage
Splice Parameters:Splice(START, deletecount, [Item1 [, item2 [,... [, itemn])
The array starts from the start subscript and deletes deletecount elements. n elements can be added at this position.
When start and deletecount are both 0, a new element is inserted at the beginning of the array.
When the parameter only has start, Deletecount is to delete from start subscriptDeletecountArray element,
When the parameter only has the start parameter, it is to delete the elements starting from the start subscript to the end.
When the parameter is negativeThis parameter specifies the position starting from the end of the array element (-1 refers to the last element in the array,-2 refers, the penultimate element in the array .)
Slice Parameters: Slice (Start, end);
The slice method is similar to the string object and the array object.
For array objects, the slice method extracts an element ending with the end subscript from the start subscript (but does not include the element of the end subscript), and then returns a new array, it has no effect on the original array,
If the parameter is negative, this parameter starts from the index at the end of the array,(-1 indicates the first and last elements in the array, and-2 indicates the second and last elements in the array .)
When a parameter is a parameter and a parameter is used, partial elements starting from start to the end are extracted.
When start is 0, it means that a new array is cloned, and the two arrays After cloning perform their respective operations,
VaR clone = array. Slice (0 );
Of course, there are other methods to clone arrays.
Use the Concat () function to copy Arrays:
Concat () is used to merge arrays. Syntax: arrayobject. Concat (arrayx, arrayx,..., arrayx)
Concat () is used for merging multiple arrays, but the returned result is a new array, instead of referencing any array used for merging. You can use this feature to connect an empty array with an array or directly clone the array without passing parameters.
VaR clone = array. Concat ();