作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
(抱歉,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/
我在 StackOverflow 和其他地方看到了很多与此类似的问题,但没有一个直接解决我的问题。我正在 THREE.js 中使用凸包生成器生成 n 边多面体。我想将方形纹理映射到每个多面体的每个面上
我是一名优秀的程序员,十分优秀!