How does scoping work with JavaScript includes?
<p>For example suppose I have the following within my HTML</p>

<pre><code>&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
</code></pre>

<p>The script defines a variable named socket.  Immediately below I have the following</p>

<pre><code>&lt;script src="/javascripts/script.js" type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>Within script.js I try to access socket and get a not defined error.  However if I use an inline script I can access the variable.  How can I access 'socket' from within script.js?</p>
