Last active
November 18, 2017 21:18
-
-
Save johntran/f637a2fbf578d60df3783672b3503b7f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 foo(a) { | |
return a() | |
} | |
function bar(a) { | |
return 1 | |
} | |
// I am passing bar in to foo. bar is a callback function to foo | |
function woof() { | |
foo(bar); | |
} | |
// I am calling foo inside woof | |
function woof() { | |
foo(); | |
} | |
// I am returning the value of foo inside woof | |
function woof() { | |
return foo(); | |
} | |
// I am saving the value of bar to a variable, and returning that value | |
function woof() { | |
var hehe = bar(); | |
return hehe; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment