> no, comma is the lowest precedence of any operator.

I think you might have misunderstood what I was saying?

ConciseBody -> AssignmentExpression -> comma is not a part of the ConciseBody 
-> you probably get a SyntaxError unless the arrow function is passed as a 
parameter to a function

So: `var a = (x) => 1, 2;` -> syntax error (not a VariableDeclaration)

Is all I was saying.

> On Mar 14, 2015, at 3:52 PM, Allen Wirfs-Brock <[email protected]> wrote:
> 
> 
> On Mar 14, 2015, at 12:37 PM, Caitlin Potter wrote:
> 
>> ConciseBody is an AssignmentExpression in this case, so I believe the comma 
>> is a syntax error.
> 
> no, comma is the lowest precedence of any operator.
> 
> hence:
> 
> a=1,2
> 
> parses as:
> 
> (a=1),2
> 
> and
> 
> a=()=>1,2
> 
> parses as:
> 
> (a=()=>1),2
> 
> Finally, note that
> 
> console.log(a=1,2)
> 
> assigns the value 1 to a, but outputs 2
> 
> Allen
> 
> 
>> 
>> 
>> 
>>> On Mar 14, 2015, at 3:29 PM, Biju <[email protected]> wrote:
>>> 
>>> I was looking into Firefox implementation of Arrow functions
>>> 
>>> And noticed this
>>> 
>>> function a(){return 1,2};
>>> a();
>>> 
>>> gives "2"
>>> 
>>> 
>>> But with same with Arrow functions
>>> 
>>> a=()=>1,2;
>>> a();
>>> 
>>> 
>>> gives "1"
>>> 
>>> 
>>> To get answer "2" in Arrow functions you need parentheses, like
>>> 
>>> a=()=>(1,2);
>>> a();
>>> 
>>> 
>>> 
>>> Is this expected ?
>>> 
>>> 
>>> 
>>> Cheers
>>> GC
>>> _______________________________________________
>>> 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
>> 
> 

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to