// 这个技巧可以让你使用Length属性在一个数组的最后添加一个元素,因为Length属性比数组的最后一个元素的下标多1。这个方法和“push”方法是相同的。例如:
var myArray = [];
myArray[myArray.length] = 'New Element';
// 调整一个数组的长度
var myArray = [1,2,3];
myArray.length // 3
myArray.length = 2; //Delete the last element
myArray.length = 20 // add 18 elements to the array; the elements have the undefined value.
// 循环array
for(var i = 0; i < array.length; i++){
alert(array[i]);
}