JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow Function Right Arrow length

length  Function  instance property

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