title: JavaScript Factorial Recursion
body: <p>In the following script, why does <code>badFactorial</code> blow the stack while <code>goodFactorial</code> works?</p>
  
  <pre><code>function badFactorial(n){
      if( n &lt; 0){
          return 1;
      }
      if(n &lt; 2){
          return n;
      }
      return badFactorial(n * (n-1));
  }
  function goodFactorial(n){
      if(n &lt; 2){
          return n;
      }
      return goodFactorial(n-1) * n;
  }
  </code></pre>