On Oct 10, 2012, at 6:19 AM, David Bruant wrote:
> Hi,
>
> I've tried the following on Firefox:
>
> function f(a, b = 34, c){
> console.log('b', b)
> }
>
> f(1, undefined, 43)
>
> and got "Exception: parameter(s) with default followed by parameter without
> default"
> It seems intentional, but I wonder why it's been decided this way.
That isn't a specified error and this function should be legal. For example,
see the note in the definition of ExpectedArgumentCount in section 13.1 of the
draft:
NOTE The ExpectedArgumentCount of a FormalParameterList is the number of
FormalParameters to the left of either the rest parameter or the first
FormalParameter with an Initialiser. A FormalParameter without an initializer
is allowed after the first parameter with an initializer but such parameters
are considered to be optional with undefined as their default value.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss