1// 题目需求 2let middleware = [] 3middleware.push((next) => { 4 console.log(1) 5 next() 6 console.log(1.1) 7}) 8middleware.push((next) => { 9 console.log(2) 10 next() 11 console.log(2.1) 12}) 13middleware.push((next) => { 14 console.log(3) 15 next() 16 console.log(3.1) 17}) 18 19let fn = compose(middleware) 20fn() 21 22 23/* 241 252 263 273.1 282.1 291.1 30*/ 31 32//实现compose函数 33function compose(middlewares) { 34 35}