Skip to content

Instantly share code, notes, and snippets.

@olov
Created October 10, 2014 19:58
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 olov/40e4bf5181e8a5f7e849 to your computer and use it in GitHub Desktop.
Save olov/40e4bf5181e8a5f7e849 to your computer and use it in GitHub Desktop.
networks sux and browsers may surprise you
index.html
...
<script src="a.js"></script>
<script src="b.js"></script>
<script src="c.js"></script>
a.js:
var globalfoo = 42;
b.js:
<whatever>
c.js:
// one of three things may happen in c.js:
// 1. it does not load (so does not execute)
// 2. it prints 42
// 3. it throws ReferenceError: globalfoo is not defined
console.log(globalfoo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment