Function.arity (Property)

The number of arguments expected by a function call.


JavaScript - 1.2
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.0
Netscape Enterprise Server - 3.0
Property/method value type:Number primitive
JavaScript syntax:-myFunction.arity

This property yields a numeric value representing the maximum number of arguments the function expects to be called with and can support.

The arity property of the Function constructor returns 1 but it accepts a variable number of arguments.

Otherwise, the arity property returns a value that is typical for the function. Because the number of arguments can often be variable, this typical value should be used with caution.

This value is not necessarily the same as the length of the arguments array that is available inside the function when it is called. This indicates the actual number of arguments that were passed.

You can compare the two values to verify that the function was called with the correct arguments.


See also:Arguments.length, Function call, Function object, Function.length, Function.prototype

Property attributes:

ReadOnly, DontDelete, DontEnum.


ECMA 262 edition 2 - section -

ECMA 262 edition 2 - section -