js合并两个数组方法

例如:

let a=[1,2,3];

let b=[4,5,6]

第一种方法

let c = a.concat(b);

第二种方法

for(let i in b){

  a.push(b[i])

}

第三种办法


a.push.apply(a,b);

 

第四种办法

var newA = [...a,...b];console.log(newA)

posted @ 2019-08-13 14:55  请再检查一遍代码  阅读(30730)  评论(0)    收藏  举报