length Property (Function) (Windows Scripting - JScript)
Returns the number of arguments defined for a function.
Syntax
functionName.length
Remarks
The required functionName is the name of the function.
The length property of a function is initialized by the scripting engine to the number of arguments in the function's definition when an instance of the function is created.
What happens when a function is called with a number of arguments different from the value of its length property depends on the function.
The following example illustrates the use of the length property:
function ArgTest(a, b){
var s = "";
s += "Expected Arguments: " + ArgTest.length;
s += "<br />";
s += "Passed Arguments: " + arguments.length;
document.write (s);
}
Requirements
Applies To: 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)