title: Anonymous function in condition in JavaScript
body: <p>I would like to use an anonymous function in the condition of an if-statement</p>
  
  <p>Using Firefox 60.7.2.esr running JS 1.5</p>
  
  <p>I tried something like this, figuring it should work like the anonymous function in a forEach statement:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>if (function() {
      var b = true;
      if (b) {
          return true;
      } else {
          return false;
      }
  }) {
      //do something 
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>My actual anonymous function is quite a bit more elaborate, but in principle it should work the same way. The problem seems to be that the anonymous function does not run at all. Is there a way to make it run?</p>