arguments 对象
函数代码中,使用特殊对象 arguments,开发者无需明确指出参数名,就能访问它们。
arguments[0] 第一个参数的值(第二个参数位于位置 1, arguments[1]
function howManyArgs() {
console.log(arguments.length, arguments);
}
howManyArgs("string", 45);
howManyArgs();
howManyArgs(12);
arguments 对象
函数代码中,使用特殊对象 arguments,开发者无需明确指出参数名,就能访问它们。
arguments[0] 第一个参数的值(第二个参数位于位置 1, arguments[1]
function howManyArgs() {
console.log(arguments.length, arguments);
}
howManyArgs("string", 45);
howManyArgs();
howManyArgs(12);
本文标题:ECMAScript arguments 对象
本文链接:https://www.haomeiwen.com/subject/rpuxlxtx.html
网友评论