一、使用 Array.prototype.push.apply 方法,将一个数组插入到另一个数组
let arry1 = ['a','b','c'];
let arry2 = [110, 120, 119];
Array.prototype.push.apply(arry1, arry2);
console.log(arry1);
效果如下:
二、使用 concat 方法连接两个数组
注意,concat 方法会返回一个新数组,所以需要赋值
let arry1 = ['a','b','c'];
let arry2 = [110, 120, 119];
let arry3 = arry1.concat(arry2)
console.log(arry3);
let arry1 = ['a','b','c'];
let arry2 = [110, 120, 119];
let arry3 = [...arry1, ...arry2]
console.log(arry3);