1.什么是arguments?
arguments是一个类似于数组的对象,对应于传递给函数的参数,他有length属性,有;
arguments[ i ]来访问对象中的元素,但是它不能用数组的一些方法。例如push、pop、slice等。
2.转换成数组的方法
Array.prototype.slice.call(arguments);
[ ].slice.call(arguments);
slice 方法得到的结果是一个数组,参数便是 arguments,满足了slice的条件
3.特点
在函数体中可以使用argumentsf对象来访问这个参数数组。
arguments对象与数组相似但是不是数组 它可以使用数组的表现形式。arguments[i]
argument[]对象的长度是由传入参数的个数决定的,不是由定义的参数个数决定的。
arguments不能使用数组方法
箭头函数里面没有arguments参数