Comma operator in Arrow functions

Juriy Zaytsev kangax at gmail.com
Sat Mar 14 19:45:50 UTC 2015


Yep, which is why it parses it as (a=()=>1),2 as far as I can see, so "1"
is expected indeed

-- 
kangax

On Sat, Mar 14, 2015 at 8:37 PM, Caitlin Potter <caitpotter88 at gmail.com>
wrote:

> ConciseBody is an AssignmentExpression in this case, so I believe the
> comma is a syntax error.
>
>
>
> > On Mar 14, 2015, at 3:29 PM, Biju <bijumaillist at gmail.com> 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
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150314/6adbf331/attachment.html>


More information about the es-discuss mailing list