共用方式為


length Property (arguments) (Windows Scripting - JScript)

 

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

Syntax

[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.

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 s = "";

   s += "Expected Arguments: " + ArgTest.length;
   s += "<br />";
   s += "Passed Arguments: " + arguments.length;

   document.write (s);
}

Requirements

Version 5.5

Applies To: arguments Object (Windows Scripting - JScript)| Function Object (Windows Scripting - JScript)

Change History

Date

History

Reason

March 2009

Simplified the example.

Information enhancement.

See Also

arguments Property (Windows Scripting - JScript)
length Property (Array) (Windows Scripting - JScript)
length Property (String) (Windows Scripting - JScript)