Skip to content

Instantly share code, notes, and snippets.

@daronwolff
Last active May 20, 2016 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daronwolff/e0661c1eff049ec1bc50b0b10365e869 to your computer and use it in GitHub Desktop.
Save daronwolff/e0661c1eff049ec1bc50b0b10365e869 to your computer and use it in GitHub Desktop.
Write a DEmethodize, a function that converts a method to a binary function Example demethodize(Number.prototype.add)(5)(6) // 11
function demethodize(func){
return function(that,y){
return func.call(that,y);
}
}
var add = (function(a) {
return function(b) {
return a + b;
}
});
demethodize(Number.prototype.add)(3)(3) // 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment