Skip to content

Instantly share code, notes, and snippets.

@jbowles jbowles/jambda.js
Created May 28, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.