title: Why does NodeJS terminate execution without throwing an exception?
body: <p>Adding the console.log in this recursive function prevents NodeJS from throwing a &quot;Maximum call stack size exceeded&quot; exception. Instead it just exits after a couple thousand iterations with no message (using Node v16.6.0 on Win10).</p>
  <p>Why does the console.log change the exception throwing behavior, and how should I catch this exception without removing the console.log?</p>
  <p>(In browsers it also throws an exception as I expected.)</p>
  <pre><code>function recursive(i) {
      console.log(i)
      return recursive(i + 1) * 2
  }
      
  try {
      recursive(0)
  } catch (ex) {
      console.log(ex)
  }
  </code></pre>