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 Latest Draft (ECMA-262) The definition of 'Arguments Exotic Objects' in that specification. |
Draft |
브라우저 호환성
Update compatibility data on GitHub
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
length | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
Legend
- Full support
- Full support