Function.prototype.myBind= function(obj,...args){ let self = this let fn=() =>{ self.call(obj,...args) } fn.prototype={...self.prototype} return fn } function foo(c){ console.log(this.a,c) return c } let a = { a:1, b:2 } console.log(foo.myBind(a,3))