Created
May 14, 2015 03:58
-
-
Save schnogz/793a0b3de524f0f519cc to your computer and use it in GitHub Desktop.
Examples of JavaScript global scoping.
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
| //globals | |
| var x = 4; | |
| function Dog() { | |
| alert("Woof"); | |
| } | |
| // 3rd party libraries use the global scope | |
| // making them accessible from anywhere an app | |
| jQuery("#myDiv").empty(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment