Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created June 17, 2016 20:50
Show Gist options
  • Save tmcw/beb738f255e4fb529357f314358f9cd1 to your computer and use it in GitHub Desktop.
Save tmcw/beb738f255e4fb529357f314358f9cd1 to your computer and use it in GitHub Desktop.
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