一、數組定義聲名數組
var arry = [1,2,3,4,5]
//至關與var arry = Array(1,2,3,4,5) it
二、數據的增刪改查console
var arry = [1,2,3,4,5]for循環
arry.push('gjlin');
console.log(arry);
arry.unshift('old');
console.log(arry);
arry.splice(1,0,'girl');
arry.splice(100,0,'OK')
console.log(arry);
arry[100] = 'kk'
console.log(arry[100]);循環
三、for循環數據
var array = [1,2,3,4,5,6];
var dic = {'name':'gjlin','age':19};
for(var item in array){
console.log(item);
}di
for(var item in dic){
console.log(item)
}
for(var i=0;i<array.length;i++){
console.log(array[i]);
}co