Write a JavaScript program to create a function that invokes the provided function with its arguments transformed
- برمجة جافاسكربت java script
- برمجة
- 2021-06-03
- ahmadghneem
الأجوبة
const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val)));
const square = n => n * n;
const double = n => n * 2;
const fn = overArgs((x, y) => [x, y], [square, double]);
console.log(fn(9,3));
console.log(fn(5,2));
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال