function curry(fn){ var args = Array.prototype.slice.call(arguments, 1); console.log("outer: ") console.log(arguments); return function(){ var innerArgs = Array.prototype.slice.call(arguments); console.log("inner: "); console.log(arguments); var finalArgs = args.concat(innerArgs); console.log(finalArgs); return fn.apply(null, finalArgs); }; } function add(num1, num2){ return num1 + num2; } var curriedAdd = curry(add, 5); console.log(curriedAdd(3));