Skip to content

Instantly share code, notes, and snippets.

@zhoufenfens
Created July 19, 2013 16:33
Show Gist options
  • Save zhoufenfens/6040519 to your computer and use it in GitHub Desktop.
Save zhoufenfens/6040519 to your computer and use it in GitHub Desktop.
this
foo = function() {
this.myName = "Foo function.";
}
foo.prototype.sayHello = function() {
alert(this.myName);
}
foo.prototype.bar = function() {
setTimeout(this.sayHello.call(this), 1000);
}
var f = new foo();
f.bar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment