1. Var arr1=new Array (2)
var arr2=new Array ()
var arr3=new Array ("A", "B")
var arr4=["A", "B"]
All of the above are declarations of arrays
2. Arrays of various methods--
Length//Lengths
Push (item)//Adds a new element to the end of the array and returns the length of the new array
Unshift (item)//Adds a new element to the beginning of the array and returns the array length
Splice ()
Arrayobject.splice (index,howmany,item1,....., ItemX)
Arr.splice (1,0, "x")//1 is the index, 0 special code, which represents the addition of instructions, X is the deletion of 0 elements, and with the subsequent "X" added in
var col=arr.splice ("X")
The splice () method deletes 0 or more elements starting at index and replaces the deleted elements with one or more values declared in the argument list. This means that 2 elements are removed from the 2nd element and replaced with an "X".
Pop ()//Remove last element
Shift ()//Remove the first element, the array element is automatically moved forward
Concat ()//Connect multiple arrays to return a new connected array
Slice (start,end)//Returns the part of an array as an array, noting that the element of end is not included, and if End is omitted, all subsequent elements are copied
Reverse ()//array rollover
Sort ()//sorting, inside can also have function, function value is greater than 0 when start element interchange--
Arr.sort (Function (v1, v2) {return v1-v2})
IndexOf ()//returns the position where the parameter appears, starting at 0, and returning when it does not exist-1
Split ()//split the string according to the parameter (all the parameters in the string disappear), make up the array
Join ()//from array to string, use parameters to concatenate each element
JavaScript statement semantics Daquan (4)