------------ ------------ restore content begins
1, a splice () method
Definition and Usage
splice () method to add / remove items from the array to /, then return items are deleted.
Note: This method changes the original array.
grammar
arrayObject.splice(index,howmany,item1,.....,itemX)
parameter | description |
---|---|
index | essential. Integer, regulations add / remove items of location, may require the use of a negative position from the end of the array. |
howmany | essential. The number of items to delete. If set to 0, it will not remove items. |
item1, ..., itemX | Optional. New projects added to the array. |
return value
Types of | description |
---|---|
Array | Contains new array is deleted items, if any. |
Explanation
splice () method can remove zero or more elements from the beginning of the index, and to replace those removed element with one or more values of the parameters declared in the list.
If you remove an element from arrayObject, then it returns an array containing the elements to be deleted.
2, using the delete operator
In this way an array of the same length, this time into a location of the content to be deleted undefined
, and the benefits are indexed original array remains unchanged