function partial(fn, ...presetArgs) {
return (...laterArgs) => fn(...presetArgs, ...laterArgs);
}
const add = (a, b, c) => a + b + c;
const addFive = partial(add, 5);
const addFiveTen = partial(addFive, 10);
console.log(addFiveTen(1), addFive(2, 3));
export {}; Post #3468
2.03K
CHALLENGE
- ❤ 3
- 🔥 3
- 👍 1