// 在 ES5 中克隆数组
var colors = [ "red", "green", "blue" ];
var clonedColors = colors.concat();
console.log(clonedColors); //"[red,green,blue]"
concat()方法的设计初衷是连接两个数组,如果调用时不传递参数就会返回当前函数的副本
// 在 ES5 中克隆数组
var colors = [ "red", "green", "blue" ];
var clonedColors = colors.concat();
console.log(clonedColors); //"[red,green,blue]"
concat()方法的设计初衷是连接两个数组,如果调用时不传递参数就会返回当前函数的副本