Created
May 28, 2012 17:20
-
-
Save jbowles/2820160 to your computer and use it in GitHub Desktop.
trying to get node lambdas/anons down
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
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