-
-
Save joepie91/3033934 to your computer and use it in GitHub Desktop.
This file contains 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
//this function adds 3 to the number passed in | |
function addThree(x) { | |
return x + 3; | |
} | |
//this function takes a function and returns | |
//a function that runs the function it was passed, | |
//and then runs that function _again_ on the return | |
//value of the first call to the function. | |
//make sense? look at it until it does. | |
function composed() { | |
return function(number) { // this is a function *definition*, not really a function call! | |
return addThree(addThree(number)) | |
} | |
} | |
composed()(4); // this actually runs whatever_was_returned_from_composed(4); | |
//what does that return? | |
var answer = ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment