Skip to content

Instantly share code, notes, and snippets.

@Shinpeim
Created October 26, 2014 13:53
Show Gist options
  • Save Shinpeim/6a2411b10f2e6c0fba1b to your computer and use it in GitHub Desktop.
Save Shinpeim/6a2411b10f2e6c0fba1b to your computer and use it in GitHub Desktop.
var f = function(a){
return a + 1;
}
var g = function(b){
return - b
}
function compose(f, g){
return function(a){
return g(f(a));
}
}
console.log(compose(f, g)(1)); // => -2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment