Share via


length Property (arguments)

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

[function.]arguments.length

Arguments

  • function
    Optional. The name of the currently executing Function object.

Remarks

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.

Note

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.

Example

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);
}

Requirements

Version 5.5

Applies To:

arguments Object

See Also

Reference

arguments Property

length Property (Array)

length Property (String)

Change History

Date

History

Reason

July 2009

Modified example.

Content bug fix.

July 2009

Modified note about the /fast option.

Content bug fix.

March 2009

Modified example and added information about the /fast option.

Information enhancement.