Created
June 22, 2011 23:27
-
-
Save mrpollo/1041548 to your computer and use it in GitHub Desktop.
Javascript use of this in OOP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function foo(){ | |
| this.test = "hello scope"; | |
| setTimeout( function(self){ self.bar(self); }, 1000, this ); | |
| } | |
| foo.prototype.bar = function(self){ | |
| console.log( self.test ); | |
| } | |
| var x = new foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment