Function.prototype._bind = function (target) { return( ()=> { this.call(target) }) } function fn() { console.log(this) } let _fn = fn._bind({age:120})
js 一个简单的bind方法的基本实现
最新推荐文章于 2022-11-03 20:58:49 发布
Function.prototype._bind = function (target) { return( ()=> { this.call(target) }) } function fn() { console.log(this) } let _fn = fn._bind({age:120})