站内搜索:
首页 >> 前端 >> 内容
获取函数参数arguments的方法

时间:2017/10/8 10:14:00

function test(){

var arr = [].slice.call(arguments,0);

console.log("arr",arr);

}

test(1,2,3)

// 输出 数组[1,2,3]

[].slice.call(arguments,0) 就获得了参数数组对象

  • 上一篇:jQuery与Zepto的异同
  • 下一篇:前端之页面性能优化
  • 返回顶部