> Le 23 mai 2017 à 16:34, Gareth Heyes <[email protected]> a écrit :
> 
> Hi all
> 
> I'd like to discuss this:-
> 
> x=x=>{}/alert(1)/+alert(2)// alerts on edge, syntax error on other browsers
> 
> So on Edge it results in two alerts but every other browser it's a syntax 
> error. Personally I think Edge is right here because it's a function 
> expression so why can't you use divide after.

This is not specific to the divide operator. If you try:

```js
x => {} * alert(1)
```

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.

> 
> x=>{}
> /alert(1)/+alert(2)//alerts twice on edge, once on other browsers

This follows from the ASI rules: non-Edge browsers add a missing semicolon 
between the two lines, because otherwise it would be a syntax error for them.

—Claude

> 
> Cheers
> Gareth
> _______________________________________________
> 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

Reply via email to