Brin-guo

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]);
}

分类:

技术点:

相关文章:

  • 2022-01-26
  • 2021-07-10
  • 2021-04-17
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2021-11-14
  • 2021-11-04
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案