★ wanayoo — archive 1999 https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Function/lengthNouvelle recherche | Portail wanayoo
Your Search Results

    Function.length

    概要

    関数の引数の数を参照します。

    Function オブジェクトのプロパティ
    実装されたバージョン JavaScript 1.1
    ECMAScript エディション ECMAScript 1st Edition

    説明

    length は function オブジェクトのプロパティであり、関数が期待する引数の数、つまり仮引数の数を参照します。

    これに対し、arguments.length は関数のローカルスコープ内で用いられ、関数が実際に受け取った引数の数……つまり実引数の数を参照するのに用いるものです。

    例

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

    Document Tags and Contributors

    タグ:
    Contributors to this page: ethertank
    最終更新者: ethertank,