First, declare an array of methods
1. var name = array [element 1, element 2, .....]
Array name is the variable name
Simple declarative method used more
2.var array name = new Array (element 1, element 2, element 3, ........)
3. Two of the difference between declarative
var arr = [10]; length 1 represents an array, the array elements 10
var arr = new Array (10); represents the length of the array 10, the array element is empty, the value is taken to undefined
Second, the three elements of the array
1. subscript
It is used to record the location of each element, and the value for the assignment
2. elements
Data array
3. length
The number of elements in the array
Third, the value of the array
1. The value of the name of the array is an array [index], index starts from 0.
2. If the maximum index in the index range, to take the corresponding element value, and if it exceeds the maximum index, is taken to the undefined value
3 takes a value of the array, the array name [0]. Takes the last value, array name [array name .length - 1].
Fourth, the array-valued
1. The array name [index] = value
2. If the index does not exceed the maximum index, the value of the array is modified.
3. If the index exceeds the maximum, add elements to the array.
4. If the added element index is not continuous, it is a discontinuous array.
Fifth, the array length
1. Get the length of the array is a data type number
2. If I change the value of the array length, then keep only the number of the corresponding elements in the array
3. Remove last element of the array, the array name .length--, the array length minus 1, is equivalent to a deletion of the last element.
4. If I is added last to the array element, the array length = max index + 1 array name [array name .length].