title: Why does this JavaScript work?
body: <p>I was looking at the output of some stuff from UglifyJS and happened across some code like the following:</p>
  
  <pre><code>var a = 0;
  var b = function () {
      return function () {
          a++;
      }(), 'Hello, World'
  }();
  </code></pre>
  
  <p>After running that code <code>a</code> is <code>1</code> and <code>b</code> is the string <code>Hello, World!</code>.</p>
  
  <p>At first glance it appears that <code>b</code> will be <code>undefined</code> since it looks like the result of a function with no return value is being returned, but that is followed by a comma and a string literal.</p>
  
  <p>Why does this work?<br>
  And why doesn't UglifyJS just execute the anonymous function and then return <code>Hello, World!</code> as the next statement?</p>