var array1 = [1,2]; var array2 = [3,4]; array1.push(5,6);//[1,2,5,6] array1.push([7,8]);//[1,2,5,6,[7,8]] Array.prototype.push.apply(array1,array2);//[1,2,5,6,[7,8],3,4]
fun.apply(this,array); //在this的作用域下,将array参数传入fun;若this = null时,为全局;
var array1 = [1,2]; var array2 = [3,4]; array1.push(5,6);//[1,2,5,6] array1.push([7,8]);//[1,2,5,6,[7,8]] Array.prototype.push.apply(array1,array2);//[1,2,5,6,[7,8],3,4]
fun.apply(this,array); //在this的作用域下,将array参数传入fun;若this = null时,为全局;