Created
February 20, 2019 20:42
-
-
Save tjeastmond/b483efbc3e6884175641a13bebd928d9 to your computer and use it in GitHub Desktop.
Helping someone with a JS question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function head() { | |
console.log("HEAD"); | |
/* Some more logic that goes down here then will return function */ | |
return function body(arg) { | |
console.log(arg); | |
function inner() { | |
console.log("INNER METHOD"); | |
} | |
// return "SOMETHING USEFUL"; | |
return { inner }; | |
}; | |
} | |
let p = head(); | |
p("HELLO BODY"); //will print "HELLO BODY" | |
p("HELLO BODY 2").inner(); //will print "HELLO BODY 2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment