Skip to content

Instantly share code, notes, and snippets.

@schnogz
Created May 14, 2015 03:58
Show Gist options
  • Select an option

  • Save schnogz/793a0b3de524f0f519cc to your computer and use it in GitHub Desktop.

Select an option

Save schnogz/793a0b3de524f0f519cc to your computer and use it in GitHub Desktop.
Examples of JavaScript global scoping.
//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