« Bugzilla Issues Index

#199 — define function length property value for default-value and rest parameters

The most reasonable definition seems to be:

The number of parameter positions (including the rest parameter if specified) that precede the first default-value parameter (or the end of the list if there are no default-value parameters):
function (a,b,c) {} //length==3
function (a,b,...c) {} //length==3
function (...c) {} // length=1
function (a=1,b=2) {} //length==0
function (a,b=1) {} //length==1
function (a,b=1,...c) {} //length==1

This treats rest as meaning "usually at least one" (unless following a default-value parameter) which seems to be the way open-ended parameter lists were interpreted in assigning length to most such Chapter 15 functions. I think that this rule would yield the most matches with the specified lengths of chapter 15 functions when their signatures are rewritten using default-value and rest parameter notation.

See thread starting at

this was settle a long time ago