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月.
arguments.length データプロパティは、関数に渡された引数の数が入ります。
非負の整数です。
| 書込可能 | 可 |
| 列挙可能 | 不可 |
| 設定可能 | 可 |
arguments.length プロパティは、実際に関数に渡された引数の数を提供します。これは、定義された仮引数の数以上にも以下にもなることがあります(Function.prototype.length を参照してください)。
func1.length は 3 を返します。これは func1 が 3 つの形式引数を宣言しているためです。しかし、func1(1, 2, 3, 4, 5) は 5 をログ出力します。これは func1 が5つの引数をつけて呼び出されたためです。同様に、func1(1) は 1 をログ出力します。これは func1 が 1 つの引数をつけて呼び出されたためです。
この例では、2 つ以上の数を加算する関数を定義しています。
| ECMAScript® 2027 Language Specification # sec-arguments-exotic-objects |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年9月18日 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.