| arity This property is used to return the number of parameters which are used within the given function. That is, it represents the number of parameters the function expects to recieve. This property is available only to JavaScript version 1.2 and up. syntax: Function.arity EXAMPLE function functionOne(numberOne, numberTwo) { var localVariableOne = numberOne - numberTwo; return localVariableOne; } document.write("The arity of the function is : " + functionOne.arity); document.write("The result of subtracting numberOne from numberTwo is : " + functionOne(5, 3) ); The functionOne function contains two parameters, in parentheses, numberOne and numberTwo. The localVariableOne variable declared within the function subtracts numberOne from numberTwo. The function then returns this new result for the subtraction into localVariableOne. The arity property is used within a documnet.write statement to return the number of parameters which functionOne has, which is two. In the second document.write statement, the values for numberOne and numberTwo are declared, which are 5 and 3, respectively. The result returned for the product of functionOne is two. |