1、slice+call()或slice+apply()
function toArray(){
var arr1 = [].slice.apply(arguments)
console.log(arr1)
}
function toArray(){
var arr1 = Array.prototype.slice.apply(arguments)
console.log(arr1)
}
function toArray(){
var arr1 = Array.prototype.slice.call(arguments)
console.log(arr1)
}
2、遍历arguments push进数组
function toArray(){
var arr2=[];
for(var i=0;i<arguments.length;i++){
arr2.push(arguments[i]);
}
console.log(arr2)
}
3、Array.from()
function toArray(){
var arr3 = Array.from(arguments);
console.log(arr3)
}
4、...解构
function toArray(){
var arr4 = [...arguments];
console.log(arr4)
}