title: How does this JavaScript/jQuery syntax work: (function( window, undefined ) { })(window)?
body: <p>Have you ever taken a look under the hood at the <strong>jQuery 1.4</strong> source code and noticed how it's encapsulated in the following way:</p>
  
  <pre><code>(function( window, undefined ) {
  
    //All the JQuery code here 
    ...
  
  })(window);
  </code></pre>
  
  <p>I've read an article on <a href="http://peter.michaux.ca/articles/javascript-namespacing" rel="noreferrer">JavaScript Namespacing</a> and another one called "<a href="http://peter.michaux.ca/articles/an-important-pair-of-parens" rel="noreferrer">An Important Pair of Parens</a>," so I know some about what's going on here.  </p>
  
  <p>But I've never seen this particular syntax before.  What is that <strong><code>undefined</code></strong> doing there? And why does <strong><code>window</code></strong> need to be passed and then appear at the end again?</p>