arguments.length
arguments.length
속성은 함수에 전달된 인수의 수를 포함하고 있습니다.
구문
arguments.length
설명
arguments.length 속성은 실제로 함수에 전달된 arguments 의 수를 제공합니다. 이것은 정의된 매개변수의 수보다 작을 수도 클 수도 있습니다. (Function.length
보기).
예제
arguments.length
사용하기
이 예시에서는 둘 또는 그 이상의 수를 더할 수 있는 함수를 정의합니다.
function adder(base /*, n2, ... */) {
base = Number(base);
for (var i = 1; i < arguments.length; i++) {
base += Number(arguments[i]);
}
return base;
}
명세
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | 초기 정의. JavaScript 1.1에서 구현됨. |
ECMAScript 5.1 (ECMA-262) The definition of 'Arguments Object' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Arguments Exotic Objects' in that specification. |
Standard | |
ECMAScript (ECMA-262) The definition of 'Arguments Exotic Objects' in that specification. |
Living Standard |
브라우저 호환성
BCD tables only load in the browser