Created
January 14, 2016 11:03
-
-
Save jmarmolejos/32b854cfebf076c102d0 to your computer and use it in GitHub Desktop.
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
| class Foo { | |
| constructor() { | |
| this.baz = "baz"; | |
| this.doStuff = this.doStuff.bind(this); | |
| } | |
| doStuff() { | |
| console.log(this.baz); | |
| } | |
| } | |
| let foo = new Foo(); | |
| setTimeout(foo.doStuff, 500); // Logs "baz", hooray! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment