arity

Indicates the number of arguments expected by the function.

Description

arity is external to the function, and indicates how many arguments the function expects. By contrast, arguments.length provides the number of arguments actually passed to the function.

Example

The following example demonstrates the use of arity and arguments.length.

function addNumbers(x,y){
      Console.Write("length = " + arguments.length)
      z = x + y 
}
Console.Write("arity = " + addNumbers.arity)
addNumbers(3,4,5)

This script writes:

arity = 2 
length = 3