//业务代码,扩展当前的业务代码
function say(a, b){
console.log('say', a, b);
}
// 给某个方法 添加一个方法 在他执行之前调用
Function.prototype.before = function(callback) {
return (...args)=>{
callback();
this(...args);
}
}
let beforeSay = say.before(function(){
console.log('before say');
});
beforeSay('hello', 'world');
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。