On 24 May 2017 at 08:57, Gareth Heyes <[email protected]> wrote:

>
>
>> you'll get a SyntaxError in all browsers but Edge, which interprets it as
>> `(x => {}) * alert(1)`.
>>
>> Given how confusing that expression is, I think that the SyntaxError is
>> the right choice.
>
>
>  Well it is a function expression. So IMO Edge is right. It's equivalent
> to:
> x=function(){} * alert(1)
>

Edge is wrong. Unlike an ordinary function expression, which is a
PrimaryExpression, an arrow function is merely an AssigmentExpression, so
has much lower precedence than any arithmetic operator. The rationale is
that its body doesn't necessarily have braces, so `x => x * 1` would be
ambiguous.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to