方法一
使用concat合并数组
var mergeTo = [4,5,6];
var mergeFrom = [7,8,9];
var a = mergeTo.concat(mergeFrom);

方法二
var mergeTo = [4,5,6];
var mergeFrom = [7,8,9];
Array.prototype.push.apply(mergeTo, mergeFrom);

使用concat合并数组
var mergeTo = [4,5,6];
var mergeFrom = [7,8,9];
var a = mergeTo.concat(mergeFrom);
var mergeTo = [4,5,6];
var mergeFrom = [7,8,9];
Array.prototype.push.apply(mergeTo, mergeFrom);
本文标题:js合并数组
本文链接:https://www.haomeiwen.com/subject/bzzcsttx.html
网友评论