Skip to content

Commit

Permalink
Update 2014-01-19-the-usage-of-this-in-javascript.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zombiezlk authored Jul 22, 2016
1 parent 05708a5 commit 54653c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _posts/2014-01-19-the-usage-of-this-in-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ category: tech
alert(this.myName);
}
foo.prototype.bar = function(){
self = this; //将bar中的this的值存在变量self中,这样self所指向的对象就跟bar中的this一样了。
var self = this; //将bar中的this的值存在变量self中,这样self所指向的对象就跟bar中的this一样了。
setTimeout(self.sayHello, 1000);
}
var f = new foo;
Expand Down

0 comments on commit 54653c1

Please sign in to comment.