Will affect the original array.
1, Shift (): Deletes the first element of the array, returning the deleted value.
2, Unshift (3,4): The parameter is loaded in front of the array, returning the length of the array.
3. Pop (): Deletes the last element of the array, returning the deleted value.
4, Push (3): Loads the parameter to the end of the array and returns the length of the array.
5, Splice (Start,deletecountnum,val1,val2,...) : Deletes the Deletecountnum entry starting from the start position and inserts the Val1,val2 from that position,..., returns the deleted value
6, reverse (): Reverse the array, return the reverse order of the array
7. Sort (orderfunction): Sorts the array by the specified parameters
If you want to sort by numeric size
A.sort (function(b) {return A- b;});
does not affect the original array.
1. Concat (arr): Two arrays are stitched together.
2, Slice (start,end): Returns a new array that consists of the entries from the original array that specify the starting subscript to the end subscript
3.join (separator): Sets the element group of the array as a string, separator as a delimiter, or by default with a comma delimiter, which receives only one argument: the delimiter. Returns the separated value
4.split (separator): Separates a string into an array, separator as a delimiter, returns the array that is composed
5.indexOf and LastIndexOf
IndexOf (): Receives two parameters: the subparagraphs (optional) to find indicates the index at which to find the starting point. Where the starting position of the array (position 0) is searched backwards
LastIndexOf (): Receives two parameters: the subparagraphs (optional) to find indicates the index at which to find the starting point. Where you start looking forward from the end of the array.
6.forEach
Arr.foreach (function+ "|" + Index + "|" + a);});
7.map
Arr.map (function(item) {return item*item});
8.filter
Arr.filter (function(x, index) {return index% 5 = = = 0 && x >= 4;});
9.every and some
Arr.every (function(x) {return x > 0});
10.reduce and Reduceright
JavaScript Array collation