Share via


length Property (arguments) (JScript 5.6) 

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


[function.]arguments.length

Remarks

The optional function argument is the name of the currently executing Function object.

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.

Example

The following example illustrates the use of the length property of the arguments object. To fully understand the example, pass more arguments to the function than the 2 arguments expected:

function ArgTest(a, b){

   var i, s = "The ArgTest function expected ";

   var numargs = arguments.length;

   var expargs = ArgTest.length;

   if (expargs < 2)

      s += expargs + " argument. ";

   else

      s += expargs + " arguments. ";

   if (numargs < 2)

      s += numargs + " was passed.";

   else

      s += numargs + " were passed.";

   return(s);

}

Requirements

Version 5.5

Applies To: arguments Object (JScript 5.6)| Function Object (JScript 5.6)

See Also

Reference

arguments Property (JScript 5.6)
length Property (Array) (JScript 5.6)
length Property (String) (JScript 5.6)