Skip to content

Instantly share code, notes, and snippets.

@jpablo
Created April 28, 2011 00:15
Show Gist options
  • Save jpablo/945532 to your computer and use it in GitHub Desktop.
Save jpablo/945532 to your computer and use it in GitHub Desktop.
Partial function application with javascript
/*
* taken from
* http://www.webreference.com/programming/javascript/rg17/
* */
Function.prototype.partial = function () {
var method = this;
var args = Array.prototype.slice.call(arguments);
return function() {
var allArguments = args.concat(Array.prototype.slice.call(arguments));
return method.apply(this, allArguments);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment