Array and method of operation
Array is a collection of data, javascript, the array of data which may be of different types.
The method defined array
// instances of objects created var of aList = new new the Array (l, 2,3 ); // directly create amount var aList2 = [l, 2,3, 'ASD'];
The method of operation of the array of data
1, obtaining the length of the array: aList.length;
var of aList = [1,2,3,4 ]; Alert (aList.length); // pop 4
2, with a data array subscripting: aList [0];
var of aList = [1,2,3,4 ]; Alert (of aList [ 0]); // pop 1
3, join () array by a partition member into a string compliance and
var of aList = [1,2,3,4 ]; Alert (aList.join ( '-')); // pop 1-2-3-4
4, push () and pop () array from the last increase in the membership or remove members
var of aList = [1,2,3,4 ]; aList.push ( . 5 ); Alert (of aList); // pop 1,2,3,4,5 aList.pop (); Alert (of aList); // pop 1,2,3,4
5, reverse () array reversed
was ALIS = [1,2,3,4 ]; aList.reverse (); alert (ALIS); // 弹出4,3,2,1
6, indexOf () returns the index of the array element first appears
was aList = [1,2,3,4,1,3,4 ]; alert (aList.indexOf ( 1));
7, splice () to add or remove members in the array
var of aList = [1,2,3,4 ]; aList.splice ( 2,1,7,8,9); // start from the second element, deleting an element, then increases in this position '7, 8,9 'three elements Alert (of aList); // pop 1,2,7,8,9,4
Multidimensional Arrays
Multidimensional array refers to an array is an array of members of the array.
var of aList = [[l, 2,3], [ 'A', 'B', 'C' ]]; Alert (of aList [ 0] [. 1]); // pop 2;
Bulk operations data array, need to use loop