作者回复: 虽然下面是bind的polyfill,但是我们可以看到new是优先于bind的 this instanceof fNOP && oThis ? this : oThis // ... and: fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); 我理解这样的优先级是为了让new可以忽略this的 hard binding,同时预置一些或全部的参数。
作者回复: 很好的对比
作者回复: 谢谢指出,这里做些修改,之后也会更新到文稿里。 function aLogger() { console.log( this.a ); } var obj = { a: 3, logger: aLogger }; var a = 2; obj.logger(); // 3