Open zonglang opened 5 years ago
call调用 var arr = Array.prototype.slice.call(arguments)(会产生稀疏数组)
var arr = Array.prototype.slice.call(arguments)
apply调用 var arr = Array.prototype.concat.apply([],arguments)(不会产生稀疏数组) var arr = Array.apply(null,arguments)(不会产生稀疏数组)
var arr = Array.prototype.concat.apply([],arguments)
var arr = Array.apply(null,arguments)
ES6的扩展运算符 var arr = [...arguments](必须有遍历接口)
var arr = [...arguments]
ES6的内置工具函数 var arr = Array.from(arguments)(不会产生稀疏数组)
var arr = Array.from(arguments)
类数组对象转数组的方法
call调用
var arr = Array.prototype.slice.call(arguments)
(会产生稀疏数组)apply调用
var arr = Array.prototype.concat.apply([],arguments)
(不会产生稀疏数组)var arr = Array.apply(null,arguments)
(不会产生稀疏数组)ES6的扩展运算符
var arr = [...arguments]
(必须有遍历接口)ES6的内置工具函数
var arr = Array.from(arguments)
(不会产生稀疏数组)