This property yields a numeric value representing the number of arguments the function expects to be called with and can support.
The length property of the Function constructor returns 1 but it accepts a variable number of arguments.
Otherwise the length 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.
There is a bug in the Netscape implementation of this property unless the LANGUAGE attribute is defined as "JavaScript1.2" for the <SCRIPT> tag.
In any case the function.length property is deprecated in favor of the arity property. This is to avoid confusion between functions and arrays.
ECMA 262 edition 2 - section - 15.3.3.2
ECMA 262 edition 2 - section - 15.3.5.1
ECMA 262 edition 3 - section - 15.3.5.1
Prev | Home | Next |
Function.constructor | Up | Function.prototype |
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. |