Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.
Microsoft® JScript®
length Property (Function)
 Language Reference 
Version 2 

See Also                  Applies To


Description
Returns the number of arguments defined for a function.
Syntax
functionname.length

The functionname argument is required and is the name of the function in question.

Remarks
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 i, s = "The ArgTest function expected ";
   var numargs = ArgTest.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);
}

Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Bitcoin Gambling Site . law school personal statement writing service