Single destructuring argument to an arrow function

Jan-Ivar Bruaroey jib at
Thu Mar 19 20:50:13 UTC 2015

Hi group! First post, so be gentle.

I love how arrow functions allow single arguments to be passed without 
parenthesis, so I expected this to work:

     Promise.all([true, false]).then([foo, bar] => console.log(foo +”, 
"+ bar));

but it doesn't:

     SyntaxError: invalid arrow-function arguments (parentheses around 
the arrow-function may help)

I understand from the spec that this is as defined, but is there a 
technical reason to disallow it?

The parenthesis seem redundant to the naked eye.


.: Jan-Ivar :.

More information about the es-discuss mailing list