arguments Property (Windows Scripting - JScript)

 

Returns the arguments object for the currently executing Function object.

Syntax

function.arguments

Remarks

The function argument is the name of the currently executing function, and can be omitted.

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 following example illustrates the use of the arguments property:

function ArgTest(){
   var s = "";
   s += "The individual arguments are: "
   for (n = 0; n < arguments.length; n++){
      s += ArgTest.arguments[n];
      s += " ";
   }
   return(s);
}
document.write(ArgTest(1, 2, "hello", new Date()));

Requirements

Version 2

Applies To: Function Object (Windows Scripting - JScript)

Change History

Date

History

Reason

March 2009

Simplified the example.

Information enhancement.

See Also

arguments Object (Windows Scripting - JScript)
function Statement (Windows Scripting - JScript)