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.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

JavaScript Basics

JavaScript Basics

JavaScript Intermediate

JavaScript Intermediate

JavaScript Advanced

JavaScript Advanced

JavaScript Reference

JavaScript Entities

Globals

Function

Class Properties
prototype
Instance Properties
constructor
length
Class Methods
None.
Instance Methods Getters
apply()
bind()
call()
toString()
Instance Methods Setters
None.

Statements

Operators