Note that real curry should return functions until all arguments are added. This is curry function I use in my code:
function curry(fn, ...init_args) { var len = fn.length; return function() { var args = init_args.slice(); function call(...more_args) { args = args.concat(more_args); if (args.length >= len) { return fn.apply(this, args); } else { return call; } } return call.apply(this, arguments); }; }
But also this function is modification of real concept of curry that return single argument functions only. Here you can use multiple arguments at once (which is much better).
You can test the curry function at: codepen.io/jcubic/pen/LxrOYP the code in demo use ES5.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Note that real curry should return functions until all arguments are added. This is curry function I use in my code:
But also this function is modification of real concept of curry that return single argument functions only. Here you can use multiple arguments at once (which is much better).
You can test the curry function at: codepen.io/jcubic/pen/LxrOYP the code in demo use ES5.