length  Function  instance propertyS2C Home  « Globals « Function « length

Description

Returns a positive integer specifying the number of formal arguments expected by a function.

Syntax

Signature Description
aFunction.lengthReturns 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');

Press the button below to action the above code:


Related Tutorials

JavaScript Intermediate Tutorials - Lesson 8 - Functions


go to home page Homepage go to top of page Top