1.push ()//can accept any parameter and then add to the end of the array
2.pop ()//stack method, delete a piece of data at the end of the array, and return this data
3.shift ()//queue method, similar to pop (), but instead, deletes a piece of data at the beginning of the array and returns the data.
4.reverse (), sort ()//array sorting method, the sort () method is sorted by default on the first letter of each data, for example: 1,3,34,21,22 If you do not pass in the comparison parameter Array.Sort () is 1,21,22,3,34
In order for it to be sorted numerically, you must add a method, function Campare (val1,val2) {return val2-val1;} and pass this method as a parameter to sort, which can be arranged in descending order Array.Sort (Campare) is 34, 22,21,3,1
5.slice (A, B);//The first parameter is the starting position of the array, and the second parameter is the end position of the array. Method function: From the original array with a as the starting position, b for the end position to take out the data output of the array
6.splice (A,c,[b,d]);//The first parameter start position, the second parameter deletes the number, the third parameter inserts the data
Method action:1> Delete data such as: Splice (A, A, b), delete the data from a as a starting position
2> inserting data such as: Splice (2,0, "Red", "blue") Insert from 2 position Red,blue
3> replace data such as: Splice (2,1, "Red", "blue") delete data from 2 position and insert red blue
Some methods of JS array