arguments转化为数组

每个函数都有arguments属性存放参数,它是类似数组,但不是数组,不能进行数组操作。

有的时候,我们需要arguments进行一些数字操作,可以将其转化为数组: 

var slice = Array.prototype.slice,
  args = slice.apply(arguments);

这样,变量args就成为存放着arguments元素的数组了。

  

原文地址:https://www.cnblogs.com/damade/p/4016452.html