Message from JavaScript discussions

July 2017

— 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

— Nope

— Normal functions never do implicit return

— But you CAN do:

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

— Without assigning it

— Normal functions NEVER do implicit return

— Hmm, I was very wrong

— This puts the inner function in expression position

— I thought all functions did it

— After playing around I see what you're telling me

— Meaning that it's name (if any) doesn't "leak" to the outer scope