1、数组定义声名
var arry = [1,2,3,4,5]
//相当与var arry = Array(1,2,3,4,5)
2、数据的增删改查
var arry = [1,2,3,4,5]
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]);
3、for循环
var array = [1,2,3,4,5,6];
var dic = {'name':'gjlin','age':19};
for(var item in array){
console.log(item);
}
for(var item in dic){
console.log(item)
}
for(var i=0;i<array.length;i++){
console.log(array[i]);
}