function_compose(...fns){if(fns.length <=0)return;for(let fn of fns){if(typeof fn !=='function'){thrownewTypeError(`The parameter contains a non-function type. Please check!`);}}returnfunction(...rest){let res = fns[0](...rest);for(let i =1; i < fns.length; i++){
res = fns[i](res);}return res;}}
三、例子
functionfn1(x){return x +22;}functionfn2(x){return x +33;}