Skip to content

Instantly share code, notes, and snippets.

@jbowles
Created May 28, 2012 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbowles/2820160 to your computer and use it in GitHub Desktop.
Save jbowles/2820160 to your computer and use it in GitHub Desktop.
trying to get node lambdas/anons down
var first = function(){return 'first';},
second = function(){return 'second';},
func_one = function(someFunction, someValue){someFunction(someValue);},
func_two = function(anotherFunction, anotherValue){anotherFunction(anotherValue);};
function say(word) {console.log(word);}
function speak(anotherWord) {console.log(anotherWord);}
/*
* run the two functions above
func_one(say, "hello -- function executing say");
func_two(speak, "world -- function executing speak");
*/
function runFunctions(a,b) {
console.log(a());
console.log(b());
}
function runFunctionsTwo(a,b) {
return a + b;
}
runFunctions(first, second);
runFunctionsTwo(func_one(say,'hello'),func_two(speak,'world'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment