title: Why using self executing function?
body: <p>In many places I see scripts like this:</p>
  
  <pre><code>(function () {
      var hello = 'Hello World';
      alert(hello);
  })();
  </code></pre>
  
  <p>Why not just write it like this, without any function:</p>
  
  <pre><code>var hello = 'Hello World';
  alert(hello);
  </code></pre>