Javascript: Wrapping entire script in a function call
<p>I've came across a few times with this phenomena in JavaScript, where an entire script is wrapped in a function call, like this:</p>

<pre><code>(function() {
    // statements...
})();
</code></pre>

<p>Real world example, from glow.mozilla.com client-side code:
<a href="https://github.com/potch/glow/blob/master/media/glow.js" rel="nofollow">https://github.com/potch/glow/blob/master/media/glow.js</a></p>

<p>What is this coding style used for? What's the difference between with and without the wrapped function style and when should it be used?</p>
