为当前执行的 function 对象返回一个arguments 对象。 function.arguments
function 参数是当前执行函数的名称,可以省略。 说明通过 arguments 属性,函数可以处理可变数量的参数。 arguments 对象的 length 属性包含了传递给函数的参数的数目。对于arguments 对象所包含的单个参数,其访问方法与数组中所包含的参数的访问方法相同。 示例下面的例子说明了 arguments 属性的用法: function argtest(){ var i, s, numargs = arguments.length; s = numargs; if (numargs < 2) s += " argument was passed to argtest. it was "; else s += " arguments were passed to argtest. they were " ; for (i = 0; i < numargs; i++) { s += arguments[i] + " "; } return(s);}
要求版本 2 请参阅function 语句 | length 属性 (array) 应用于: function 对象
|