[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Function/length [Back]  [Original]

Function.prototype.length - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Function.prototype.length

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

length .

In this article

function func1() {}

function func2(a, b) {}

console.log(func1.length);
// Expected output: 0

console.log(func2.length);
// Expected output: 2

Property attributes of Function.prototype.length

length , , . . , arguments.length (local) .

Function length . . . arguments.length .

Function function . length 1.

Function.prototype . Function.prototype length 0.

length

js
console.log(Function.length); // 1

console.log((() => {}).length); // 0
console.log(((a) => {}).length); // 1
console.log(((a, b) => {}).length); // 2 etc.

console.log(((...args) => {}).length);
// 0,    

console.log(((a, b = 1, c) => {}).length);
// 1,      

Specification
ECMAScript 2027 LanguageSpecification
# sec-function-instances-length


Web Proxy Viewer  |  New URL  |  Original Page