谁掉用他,this对象就指向谁
function test(){ alert(this.m)} window.test(); window.m =100;
this.m= 1000; var obj ={
m:100,
test:function(){
alert(this.m)
return function(){
alert(this.m)
} }}
obj.test();
谁掉用他,this对象就指向谁
function test(){ alert(this.m)} window.test(); window.m =100;
this.m= 1000; var obj ={
m:100,
test:function(){
alert(this.m)
return function(){
alert(this.m)
} }}
obj.test();
本文标题:this 指针使用
本文链接:https://www.haomeiwen.com/subject/mjcmjftx.html
网友评论