Function.length values?

# Oliver Hunt (15 years ago)

Microsoft has just recently (as far as i was aware) added JS tests to the IE testing center and a number of the tests test the value of someFunction.length, I can't see where these values are actually specified for functions with optional arguments, what am I missing?

# Allen Wirfs-Brock (15 years ago)

Introduction to Chapter 15, third paragraph from bottom:

"Every built-in Function object described in this clause-whether as a constructor, an ordinary function, or both-has a length property whose value is an integer. Unless otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the function description, including optional parameters."

# Brendan Eich (15 years ago)

On Jun 23, 2010, at 3:34 PM, Oliver Hunt wrote:

Microsoft has just recently (as far as i was aware) added JS tests to the IE testing center and a number of the tests test the value of someFunction.length, I can't see where these values are actually specified for functions with optional arguments, what am I missing?

ES5 clause 15, intro:

"Every built-in Function object described in this clause—whether as a constructor, an ordinary function, or both—has a length property whose value is an integer. Unless otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the function description, including optional parameters."