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.
There is a bug in the Netscape implementation of this property unless the LANGUAGE attribute is defined as "Javascript1.2" for the <SCRIPT> tag.
Prev | Home | Next |
Function.arguments[] | Up | Function.call() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |