What is the difference between these two javascript constructs
<pre><code>var myObject = (function(){

  var value = 0;

  return {
    getValue: function(){
      return value;
    }
  }

}());



var myObject = (function(){

  var value = 0;

  return {
    getValue: function(){
      return value;
    }
  }

})();
</code></pre>

<p>The execution seems to return the same Object. i.e., myObject contains </p>

<pre><code>  {{
    getValue: function(){
      return value;
    }
  }}
</code></pre>

<p>in both the cases.</p>

<p>I know something like <code>(function(){})()</code> executes because <code>(function(){})</code> is an expression which returns a function and the trailing <code>()</code> executed the function being returned.</p>

<p>But why does this execute <code>(function(){}())</code> ? I was expecting a syntax error here.</p>
