Q:

Write a JavaScript program to curry (curries) a function

0

Write a JavaScript program to curry (curries) a function.

All Answers

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

const curry = (fn, arity = fn.length, ...args) =>
  arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args);
console.log(curry(Math.pow)(2)(8));
console.log(curry(Math.min, 3)(10)(50)(2));

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