将传入的数组或非数组值与原数组合并
思想:可以用于数组合并,并且不改变原数组,返回一个新数组,
push效果的另类用法
var a = [1,2,3];
document.write(a.concat(4,5));
var b= [4,5];
document.write("<br>");
document.write(a.concat(b));
输出结果:
将传入的数组或非数组值与原数组合并
思想:可以用于数组合并,并且不改变原数组,返回一个新数组,
push效果的另类用法
var a = [1,2,3];
document.write(a.concat(4,5));
var b= [4,5];
document.write("<br>");
document.write(a.concat(b));
输出结果: