| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/length | [Back] [Original] |
Get to know MDN better
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 | |
|---|---|
length function property function rest parameter (Default Parameters) arguments.length function function
Function data propertyFunction Function length data property 1 property attributes : Writable: false, Enumerable: false, Configurable: true.
Function prototype propertyFunction prototype length property 0
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 |
This page was last modified on 2026526 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |