// Created on savesnippets.com ยท https://savesnippets.com/1M1HKZaec12LeN function curry(fn) { return function curried(...args) { if (args.length >= fn.length) { return fn.apply(this, args); } return function (...more) { return curried.apply(this, args.concat(more)); }; }; } // Usage const add = curry((a, b, c) => a + b + c); const add5 = add(5); const add5and3 = add5(3); console.log(add5and3(2)); // 10