js异步发展的流程 发表于 2019-07-15 | 更新于: 2019-12-10 字数统计: 94 字 | 阅读时长 ≈ 1 分钟 123456789101112131415161718192021Function.prototype.before=function(callback){ let self=this; return function(){ callback(); self.apply(self,arguments) }}function fn(val){ console.log('有一定的功能了',val);}let newFn=fn.before(()=>{ console.log('在函数执行之前执行这段...')})newFn()// 在函数执行之前执行这段...// 有一定的功能了 undefinednewFn(1)// 在函数执行之前执行这段...// 有一定的功能了 1