length
Function
instance property
JS Home <<
JS Reference <<
Function <<
length
Description
Returns a positive integer specifying the number of formal arguments expected by a function.
Syntax
Signature | Description |
---|---|
aFunction.length | Returns a positive integer specifying the number of formal arguments expected by a function. |
Parameters
None.
Examples
The code below displays a Function
objects arguments length.
// Create a Function object and get the number of arguments.
var newFunction = new Function('a', 'return a * a');
alert(newFunction.length + ' - Number of arguments');
Related Tutorials
JavaScript Intermediate Tutorials - Lesson 8 - Functions