// test let test = (function () { var r = bindThis( function (a, b) { return this.test + a + b; }, { test: 2 } )(2, 3); return r === 7; })();
// 个人做法仅供参考 function bindThis(f, oTarget) { return function() { oTarget.f = f; return oTarget.f(...arguments); } }