Created
June 17, 2016 20:50
-
-
Save tmcw/beb738f255e4fb529357f314358f9cd1 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
function addANumberToAthing(a) { | |
function doSomethingWithItInScope(b) { | |
return a + b; | |
} | |
return [1, 2, 3].map(doSomethingWithItInScope); | |
} | |
// versus | |
function doSomethingWithItInScope(b) { | |
return function(a) { | |
return a + b; | |
}; | |
} | |
function addANumberToAthing(a) { | |
return [1, 2, 3].map(doSomethingWithItInScope(a)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment