This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

length

Summary

Returns the actual number of arguments passed to a function by the caller.

Syntax

[ function.] arguments.length

Examples

The following example illustrates the use of the length property of the arguments object. To fully understand the example, pass more arguments to the function than the 2 arguments expected:

function ArgTest(a, b){
    var s = "";

    s += "Expected Arguments: " + ArgTest.length;
    s += "<br />";
    s += "Passed Arguments: " + arguments.length;

    document.write (s);
 }

Remarks

The optional function argument is the name of the currently executing Function object.

The length property of the arguments object is initialized by the scripting engine to the actual number of arguments passed to a Function object when execution begins in that function.

See also

Other articles

Attributions

  • Microsoft Developer Network: Article