Message from JavaScript discussions

July 2017

— But without, due to block, it is a definition?

— 

/* no implicit return */
const returnThing = () => {
(function () {});
};

/* implicit return */
const returnThing = () =>
(function () {});

— Very interesting

— Arrow functions have:
=> <expr>
OR
=> <block>

— Of which one of them has implicit return

— I get the reasoning but I wonder what the parser sees

— Normal functions require the block

— It would seem it disappears from execution context of the statement, I think

— So if I set a variable to the function like so

function returnThing () {

  var thing = function () {};

}

I think that should do implicit return

Message permanent page

— Nope

— Normal functions never do implicit return

— But you CAN do:

function returnThing () {
return function () {};
}