Q:

Write a JavaScript program that takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function

0

Write a JavaScript program that takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.

All Answers

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

const spreadOver = fn => argsArr => fn(...argsArr);
const arrayMax = spreadOver(Math.max);

console.log(arrayMax([1, 2, 3]));

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