title: javascript - shortcut for calling a function at the same time it is defined
body: <p>to call a function at the same time it's defined, i had been using:</p>
  
  <pre><code>var newfunc = function() {
      alert('hi');
  };
  newfunc();
  </code></pre>
  
  <p>is the following the correct way of combining these 2:</p>
  
  <pre><code>var newfunc = function() {
      alert('hi');
  }();
  </code></pre>