Skip to content

Instantly share code, notes, and snippets.

@johntran
Last active November 18, 2017 21:18
Show Gist options
  • Save johntran/f637a2fbf578d60df3783672b3503b7f to your computer and use it in GitHub Desktop.
Save johntran/f637a2fbf578d60df3783672b3503b7f to your computer and use it in GitHub Desktop.
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