arguments Property

Returns the arguments object for the currently executing Function object.



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


The arguments property allows a function to handle a variable number of arguments. The length property of the arguments object contains the number of arguments passed to the function. The individual arguments contained in the arguments object can be accessed in the same way array elements are accessed.


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 arguments property.

function ArgTest()
    var newline = "\n";

    var s = "";
    s += "The individual arguments are:"
    s += newline

    for (var n = 0; n < arguments.length; n++)
        s += "argument " + n.toString();
        s += " is " 
        s += ArgTest.arguments[n];
        s += newline
print(ArgTest(1, 2, "hello", new Date()));

The output of this program is as follows:

The individual arguments are:
argument 0 is 1
argument 1 is 2
argument 2 is hello
argument 3 is Sat Jan 1 00:00:00 PST 2000


Version 2

Applies To:

Function Object

See Also


arguments Object

function Statement