arrow function syntax simplified

Rick Waldron waldron.rick at gmail.com
Wed Mar 28 12:50:43 PDT 2012


On Wed, Mar 28, 2012 at 3:26 PM, Kevin Smith <khs4473 at gmail.com> wrote:

> - Incorrectly using "return" for those that don't fully understand TCP.
>>
>
> As an illustration, consider this case:
>
>     element.onclick = (evt) => do {
>
>         if (this.alreadyWaitingForAjaxResponse)
>              return;
>
>         this.startAnAjaxRequest();
>     };
>
> Presumably the early return will throw an exception, since the binding
> context has exited before the event handler is called.  (Please correct me
> if I'm wrong.)
>

I agree with your presumption and would hope that, as it does today, do {
return "x"; } would continue to throw the exception SyntaxError: Illegal
return statement.

var i = 0; do { i++; return "x"; } while(!i);

> SyntaxError: Illegal return statement

var i = 0; do { i++; "x"; } while(!i);

> "x"


Rick







> kevin
>
> _______________________________________________
> 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/20120328/bb795411/attachment.html>


More information about the es-discuss mailing list