Why is concise body for method definition dropped?

Matthew Robb matthewwrobb at gmail.com
Wed Jun 5 08:14:06 PDT 2013


At one point I was under the impression that the following would produce an
implicit return method:

class x {
   method(x) x+x
}


On Wed, Jun 5, 2013 at 8:07 AM, Rick Waldron <waldron.rick at gmail.com> wrote:

>
>
>
> On Wed, Jun 5, 2013 at 10:56 AM, Matthew Robb <matthewwrobb at gmail.com>wrote:
>
>> Does a concise body method still return by default?
>>
>
> ArrowFunction offers implicit return in the unbraced form:
>
> let two = () => 1 + 1;
> two(); // 2
>
> Whereas the braced form requires an explicit return, otherwise returning
> the default undefined.
>
> Rick
>
>
>
>  /snip
>



-- 
- Matthew Robb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130605/3edef827/attachment.html>


More information about the es-discuss mailing list