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
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to