Q:

Write a JavaScript program to create a function that invokes fn with partials prepended to the arguments it receives

0

Write a JavaScript program to create a function that invokes fn with partials prepended to the arguments it receives.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const partial = (fn, ...partials) => (...args) => fn(...partials, ...args);
const greet = (greeting, name) => greeting + ' ' + name + '!';
const greetHello = partial(greet, 'Hello');
console.log(greetHello('John'));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now