Array:
The array object in JS is essentially the same as the collection in Java, and its length is variable. The element can be any type of object.
Defined:
New Array (); New Array (size); New Array (element0, Element1, ..., elementn); var array = [Element0,element1,..., ELEMENTN];
Define a two-dimensional array var array2w = [ [Element0,element1,..., elementn], [Element0,element1,..., ELEMENTN], [Element0,element1,..., Elementn]];
Common properties: Length Common methods:
Concat () |
Joins two or more arrays and returns the result. |
Join () |
Put all the elements of the array into a string. element is delimited by the specified delimiter. |
Pop () |
Delete and return the last element of the array |
Push () |
Adds one or more elements to the end of the array and returns the new length. |
Reverse () |
Reverses the order of the elements in the array. |
Shift () |
Delete and return the first element of the array |
Sort () |
Sorting elements of an array |
ToString () |
Converts the array to a string and returns the result. |
Unshift () |
Adds one or more elements to the beginning of the array and returns the new length. |
The definition of JS array object and its related properties and methods