function myConcat(a, b) {
a.concat(b); // 1ms
}
function myPush(a, b) {
a.push.apply(a, b); // 14ms
}
function test(fn, a, b) {
var start = new Date().getTime();//起始时间
fn(a, b);
var end = new Date().getTime();//接受时间
return (end - start)+"ms";
}
console.log('concat:'+test(myConcat, new Array(100000).fill(1), new Array(100000).fill(2)));
console.log('push:'+test(myPush, new Array(100000).fill(1), new Array(100000).fill(2)));