关于Arguments对象

The arguments object is an Array-like object corresponding to the arguments passed to a function.

The arguments object is not an Array. It is similar to an Array, but does not have any Array properties except length. For example, it does not have the popmethod. However it can be converted to a real Array:

----MDN

  • 根据MDN上的描述 :
    Arguments只是一个类数组的对象,并不是一个真的数组,它只有一个length属性,但是可以转化成数组:
var args = Array.prototype.slice.call(arguments);
var args = [].slice.call(arguments);

// ES2015 
//The Array.from() method creates a new Array instance
// from an array-like or iterable object.
const args = Array.from(arguments);
posted @ 2018-08-04 10:09  GaaraHan  阅读(203)  评论(0编辑  收藏  举报