Skip to content

Instantly share code, notes, and snippets.

@colinmegill
Created February 13, 2013 20:42
Show Gist options
  • Save colinmegill/4948047 to your computer and use it in GitHub Desktop.
Save colinmegill/4948047 to your computer and use it in GitHub Desktop.
This is a forge gist for the advanced javascript workshop on currying.
function curry(callback, context) {
var curryArgs = Array.prototype.slice.call(arguments, 2);
return function() {
var args = Array.prototype.slice.call(arguments);
callback.apply(context, curryArgs.concat(args));
}
}
var printHi = curry(console.log, console, 'hi');
printHi('one','two')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment