title: What do parentheses surrounding an object/function/class declaration mean?
body: <p>I'm new to both JavaScript and <a href="http://developer.yahoo.com/yui/" rel="noreferrer">YUI</a>. In YUI library examples, you can find many uses of this construct:</p>
  
  <pre><code>(function() {
      var Dom = YAHOO.util.Dom,
      Event = YAHOO.util.Event,
      layout = null,
          ...
  })();
  </code></pre>
  
  <p>I think the last couple of parentheses are to execute the function just after the declaration.</p>
  
  <p>... But what about the previous set of parentheses surrounding the function declaration?</p>
  
  <p>I think it is a matter of scope; that's to hide inside variables to outside functions and possibly global objects. Is it? More generally, what are the mechanics of those parentheses?</p>