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

Function.length - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Function.length

Baseline Widely available

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

length property function

Function.length

In this article

length function property function rest parameter (Default Parameters) arguments.length function function

Function data property

Function Function length data property 1 property attributes : Writable: false, Enumerable: false, Configurable: true.

Function prototype property

Function prototype length property 0

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

console.log(function () {}.length); /* 0 */
console.log(function (a) {}.length); /* 1 */
console.log(function (a, b) {}.length); /* 2 . */

console.log(function (...args) {}.length); /* 0, rest parameter  */

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

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


Web Proxy Viewer  |  New URL  |  Original Page