首页 新闻 赞助 找找看

javascript this问题

0
[已关闭问题] 关闭于 2017-01-04 10:45
var s=function(a){
 this.a=a;
}
s.hello=function(str){
   console.info(str);//test
   console.info(this);//function (a){this.a=a;}
}
s.hello('test')

这里的this不应该是window吗,s.hello('test')不是等价s.hello.call(undefined,'test');undefined默认为window。s.hello这个默认把s看作成对象了吗???

不被女生喜欢好多年的主页 不被女生喜欢好多年 | 初学一级 | 园豆:39
提问于:2017-01-04 10:38
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册