Skip to content

Instantly share code, notes, and snippets.

@afc163
Last active December 21, 2015 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afc163/6366114 to your computer and use it in GitHub Desktop.
Save afc163/6366114 to your computer and use it in GitHub Desktop.
Find the new global variable.
(function() {
// save global scope
var scope = [];
for(var p in window) {
scope.push(p);
}
// code
window.a = 1;
// check global scope
// find the new global variable
for(var property in window) {
if (scope.indexOf(property) === -1) {
console.log('Found ' + property);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment