reduce使用
作者:互联网
// const add = (x) => x + 5;
// const multiplication = (x) => x * 5;
// const subtraction = (x) => x - 5;
// const division = (x) => x / 5;
// const handleFn = (...fns) => {
// return fns.reduce((prev, cur) => {
// return (...args) => {
// const res = prev(...args);
// return cur(res);
// };
// });
// };
// const targetFn = handleFn(add, multiplication, subtraction, division);
// console.log(targetFn(5));
标签:division,return,cur,...,targetFn,reduce,使用,const 来源: https://www.cnblogs.com/whh666/p/16297803.html