2016-10-28 14:00发布
function Aaa(){ this.a = 12; setInterval(this.show,1000); } Aaa.prototype.show = function(){ console.log(this.a); } var a = new Aaa();
按照理解window里没有show的方法,结果打印出来的是a对象,理解不了,求大神指点
当执行到 new Aaa()时,function Aaa中的this就已经绑定成新创建的object了。
new Aaa()
function Aaa
this
object
最多设置5个标签!
当执行到
new Aaa()时,function Aaa中的this就已经绑定成新创建的object了。一周热门 更多>