A dumb question on Javascript syntax
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2421911/what-is-the-purpose-of-wrapping-whole-javascript-files-in-anonymous-functions-lik">What is the purpose of wrapping whole Javascript files in anonymous functions like “(function(){ … })()”?</a>  </p>
</blockquote>



<p>Hi, I am very new to Javascript and really need a quick answer to the following question:</p>

<p>I came across a JS file that can be summarized to the code below:</p>

<pre><code>   (function(window){
              // some codes here
                    })(window);
</code></pre>

<p>I wonder what does this block of code mean? does the window has special meanings, Or it is just a parameter? What are the diffs between the two "window" we see in the brackets? </p>

<p>Since this function does not have a name, I assume it is anonymous function, so is it only invoked once? and When is it invoked?</p>

<p>Thanks</p>
