Get to know MDN better
此頁面由社群從英文翻譯而來。了解更多並加入 MDN Web Docs 社群。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
length property 表示該 function 預期被傳入的參數數量
| 可寫 | 否 |
| 可列舉 | 否 |
| 可配置 | 是 |
length 是 function 物件的一個 property,表示該 function 預期被傳入的參數數量,這個數量並不包含 rest parameter 且只包涵第一個預設參數(Default Parameters)前的參數。相較之下 arguments.length 是 function 內部的物件,會提供真正傳進 function 中的參數數量。
Function 建構子本身就是一個 Function 物件。其 length data property 的值為 1。此 property 的 attributes 包含: Writable: false, Enumerable: false, Configurable: true.
Function prototype 物件的 length property 其值為 0。
| ECMAScript® 2027 Language Specification # sec-function-instances-length |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年7月14日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.