(抱歉,javascript 中的另一个this
问题。)
我有下面的代码,我想知道最后调用中的“this”代表什么——Window 还是 Bird?
var Bird = (function () {
Bird.name = 'Bird';
function Bird(name) {
this.name = name;
}
Bird.prototype.move = function (feet) {
return alert(this.name + (" flew" + feet + "ft."));
};
return Bird;
}).call(this);
最佳答案
好吧,假设没有父作用域,它是 window
编辑:参见示例:http://jsfiddle.net/Umseu/1
关于javascript - 'this' 在下面的 javascript 中代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10337368/