JScript  

arguments Property

Returns the arguments object for the currently executing Function object.

function.arguments

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

Remarks

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.

Example

The following example illustrates the use of the arguments property:

function ArgTest(){
   var i, s, numargs = arguments.length;
   s = numargs;  
   if (numargs < 2)
      s += " argument was passed to ArgTest. It was ";
   else
      s += " arguments were passed to ArgTest. They were " ;
   for (i = 0; i < numargs; i++)
      {
         s += arguments[i] + " ";
      }
   return(s);
}

Requirements

Version 2

See Also

Arguments Object | function Statement

Applies To: Function Object