JavaScript - Encapsulation?
<p>A long time ago, I saw someone encapsulate their entire javascript block with code something like the code below:</p>

<pre><code>&lt;html&gt;
&lt;body&gt;
...
&lt;script&gt;
(function(){ ... })(this);
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Questions:</p>

<ol>
<li>Is the code above correct?</li>
<li>What benefit is there to encapsulating the entire javascript block like denoted above?</li>
</ol>
