Export (0) Print
Expand All

length Property (arguments)

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

[function.]arguments.length

function

Optional. 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.

NoteNote

The arguments object is not available when a program is running in fast mode, the default for JScript. To compile a program that uses the arguments object from a command prompt, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET because of threading issues. For more information, see arguments Object.

The following example illustrates the use of the length property of the arguments object.

function ArgTest(a, b)
{
    print ("Expected Arguments: " + ArgTest.length);
    print ("Passed Arguments: " + arguments.length);
   
    var s = "The individual arguments are: "
    for (var n = 0; n < arguments.length; n++)
    {
       s += ArgTest.arguments[n];
       s += " ";
    }
    print (s);
}

Community Additions

ADD
Show:
© 2015 Microsoft