Skip to content

Instantly share code, notes, and snippets.

@efleming969
Last active December 19, 2015 19:19
Show Gist options
  • Select an option

  • Save efleming969/6005582 to your computer and use it in GitHub Desktop.

Select an option

Save efleming969/6005582 to your computer and use it in GitHub Desktop.
Example Curry Function in JavaScript
var curry = function(fn) {
var result = function() {
var newArgs = Array.prototype.slice.call(arguments, 0);
if (newArgs.length >= fn.length) {
var finalResult = fn.apply(null, newArgs);
return finalResult;
} else {
return Function.prototype.bind.apply(result, [null].concat(newArgs));
}
};
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment