https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/this
那麽a.run中的this, 根据
函数以对象里的方法的方式进行调用时,它们的this由调用该函数的对象进行设置。
this就是a
对於返回的匿名function来讲, 没有调用该函数的对象, 故此处是直接调用
this是global对象window
同上推理可知, b.run中this是b
h.run()()不就是a.run()()改了个名吗..换身马甲就不认识了?~~
不认识了的话也行
同上推理
h.run()中this是h
返回了个匿名函数, this是window
PS this很坑, 除非你能确保你大部分理解了, 最好不要用
比如说
A = function(){this.Temp = 0}
A.prototype.Test = function(){return this.Temp}
(a.Test)()
(a.Test,a.Test)()