Douglas Crockford wrote in his book (Page 4):
Throughout the book, a method method is used to define new methods, This is its definition:
Example: Currying can be rewritten as follows, if anyone got stuck. See jsFiddle demo
Function.prototype.curry = function ( ) {
var slice = Array.prototype.slice;
var args = slice.apply(arguments);
var that = this;
return function () {
return that.apply(null,args.concat (slice.apply(arguments)));
}
};
var add = function(a, b)
{
return a + b;
}
var add1 = add.curry(1);
document.writeln(add1(6)); // 7