title: What does javascript closure on anonymous function mean,and when to use closed anonymous functions?
body: <p>I understand that there are self executable anonymous functions such as:</p>
  
  <pre><code>var func = function(){
     return 'hello';
  }();
  </code></pre>
  
  <p>And i have seen another version of it with closures.</p>
  
  <pre><code>var func = (function(){
     return 'hello';
  }());
  </code></pre>
  
  <p>as far as i have tested both syntax delivers same result and has similar behavior.Whats the purpose for having closures? thanks in advance.</p>