You /are/ actually passing in a second argument though, your second argument is `undefined`. Default arguments aren't meant to replace `undefined` values, they're meant to be permissible for omission. -- Keith Cirkel
On 10 October 2012 14:19, David Bruant <[email protected]> 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. > > It seems that default values for parameters "in the middle" can be useful > for older code base where parameters haven't been organized in prevision of > default value without requiring a refactoring involving switching parameter > order for all calls. > > David > > function f(a, b = 34, c){ > > > > > console.log('b', b) > } > > f(1, undefined, 43) > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

