Share via


0...n Properties

Returns the value of individual arguments from an arguments object returned by the arguments property of an executing function.

[function.]arguments[[n]]

Arguments

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

  • n
    Required. Non-negative integer in the range of 0 to arguments.length-1 where 0 represents the first argument and arguments.length-1 represents the final argument.

Remarks

The values returned by the 0...n properties are the values passed to the executing function. While the arguments object is not an array, the individual arguments that comprise the arguments object are accessed the same way that array elements are accessed.

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 0...n properties of the arguments object.

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
    }
    return(s);
}
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

Requirements

Version 5.5

Applies To:

arguments Object| Function Object

See Also

Other Resources

Properties (Visual Studio - JScript)

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 note about the /fast option.

Information enhancement.