javascript---》arguments对象

使用arguments可以直接访问函数传入的实参

如:arguments[0]访问第一个参数,arguments[1]访问第二个参数

arguments.length检测函数的参数个数

如:

function howManyArgs() {
  alert(arguments.length);
}

howManyArgs("string", 45);
howManyArgs();
howManyArgs(12);
显示 "2"、"0" 和 "1"。

函数可接受任意个数的参数(根据 Netscape 的文档,最多可接受 255 个)

原文地址:https://www.cnblogs.com/sallet/p/4142802.html