函数中的arguments

95 阅读1分钟

1.arguments对象是所有非箭头函数中都可以使用的局部变量,可以使用arguments对象在函数中获取函数的参数

2.arguments 不是Array,是类数组,只有length属性和索引元素, 无其他数组的方法

3.可以转为真正的数组

const args = Array.from(arguments);
const args = [...arguments];