Definition of array:
Method 1.
Method 2.
Definition and initialization together:
Or:
Javascript two-dimensional array, use one-dimensional array to simulate:
Method 1.
Javascript arrays do not need to set the length and will expand themselves. The array name.length returns the number of elements
Common functions for JavaScript arrays:
toString(): Convert the array into a string
toLocaleString(): Convert the array into a string
join(): Convert the array into a symbolically connected string
shift(): Remove an element from the head of the array
unshift(): Insert an element at the head of the array
pop(): Delete an element from the tail of the array
push(): Add an element to the tail of the array
concat(): Add to the array Element
slice(): Returns part of the array
reverse(): Sort the array in reverse order
sort(): Sort the array
splice(): Insert, delete or replace an array Element