看一篇更好的文章:https://www.jianshu.com/p/c9d...exportdefaultfunctioncompose(...funcs){if(funcs.length===0){returnarg=>arg}if(funcs.length===1){returnfuncs[0]}返回函数。reduce((a,b)=>(...args)=>a(b(...args)))}compose(f1,f2,f3,f4)(args)执行顺序为:f1(f2(f3(f4(args))))

看一篇更好的文章:https://www.jianshu.com/p/c9d...exportdefaultfunctioncompose(...funcs){if(funcs.length===0){returnarg=>arg}if(funcs.length===1){returnfuncs[0]}返回函数。reduce((a,b)=>(...args)=>a(b(...args)))}compose(f1,f2,f3,f4)(args)执行顺序为:f1(f2(f3(f4(args))))