this.f = function() {};
wind开发者_StackOverflow中文版ow.d = function() {};
d();
f();
Any difference?
Not if it's run barely (e.g. not within special functions etc.). Because then this === window.
In constructor functions etc. this has another meaning, so then it matters:
function x() {
this.a = 123;
}
Now,
x()would setwindow.ato123var test = new x()would settest.ato123.
加载中,请稍侯......
精彩评论