What's the benefit of inline function calls?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/11304566/functions-with-no-name">Functions with no name?</a>  </p>
</blockquote>



<p>I saw this code (explicly it's in jQuery, with modification)</p>

<pre><code>(function(window,undefined){
    var jQuery=(function(){
        var jQuery=something;
        jQuery.xxx=xxx;
        //...
        return jQuery;
    })();
    //...
    window.jQuery=window.$=jQuery;
})(window);
</code></pre>

<p>While I understand wrapping code in a inline function call can clearly define the variable scope, I don't understand the benefits of</p>

<ol>
<li>passing <code>window</code> with a parameter instead of using it directly,</li>
<li>getting an instance of <code>undefined</code> by a undefined parameter, and also</li>
<li>defining <code>jQuery</code> by the return value of another inline function call (isn't that defining it directly is better with less code?).</li>
</ol>

<p>Can somebody explain a bit?</p>
