const partial = (func, ...args) => { return (...rest) => { return func.apply(this, [...args, ...rest]); } } function sum(a, b) { return a + b; } const sum_add_1 = partial(sum, 1); console.log(sum_add_1(2));