Q:

Write a JavaScript program to create a function that invokes each provided function with the arguments it receives and returns the results

0

Write a JavaScript program to create a function that invokes each provided function with the arguments it receives and returns the results.

All Answers

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

const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args));
const minMax = over(Math.min, Math.max);
console.log(minMax(1, 2, 3, 4, 5)); 
console.log(minMax(1, 2, 5, 4, 3)); 
console.log(minMax(1, 2, 5, -4, 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