Created
February 12, 2014 14:27
-
-
Save olenhad/8956472 to your computer and use it in GitHub Desktop.
A Micro Treatise on Scoping in JS
This file contains 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
var O = { | |
foo : function (callback){ | |
callback(); | |
}, | |
bar : function () { | |
this.baz(); | |
}, | |
baz: function () { | |
console.log("fml"); | |
}, | |
main : function () { | |
this.foo(this.bar); | |
} | |
} | |
O.main(); | |
// for added fun, add a console.log(this) to O.bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment