title: What is the difference between these two Module pattern forms in Javascript?
body: <p>I've noticed that in different code samples on the web that there are two different closure forms -- but I haven't been able to find anything that identifies the difference (if any) between the two.</p>
  
  <pre><code>var module = (function() { ... })()
  </code></pre>
  
  <p>and</p>
  
  <pre><code>var module = (function() { ... }())
  </code></pre>
  
  <p>They both <em>seem</em> functionally equivalent in the sample below, but I seem to recall that at one time, the distinction was important (code worked with one form but not the other).</p>
  
  <pre><code>var sdk =(function(){
  var privacy='illusion';
  return (
      { 
          getPrivacy: function(){return privacy;}
      });
  })()
  
  console.log(sdk.getPrivacy());
  </code></pre>
  
  <p>seems to be identical to that the code fragment where the next-to-last line is replaced with <code>}())</code></p>
  
  <p>The same also seems to be true if I pass in a Module object to associate the public properties/methods to:</p>
  
  <pre><code>var sdk =(function($){
    var privacy='illusion';
    $.getPrivacy = function() { return privacy;}
    return($);
  })(sdk=sdk||{})
  
  console.log(sdk.getPrivacy());
  </code></pre>
  
  <p>or its counterpart form ending in <code>}(sdk=sdk||{}))</code></p>