title: Returning factorials in JavaScript
body: <p>I'm trying to create a script that returns the factorial of the input number as part of a challenge. When I try to run it, it returns the proper factorial, but apparently I did it wrong somehow.</p>
  
  <p>It looks like this:</p>
  
  <pre><code>function FirstFactorial(num) { 
      if (num &gt; 1) {
      var x = num;
      for (var i = 1; i &lt; x; i++) {
        num = num * i;
      }
    } else if (num === 1) {
      return 1;
    } else {
      console.log("That's not a number!");
    }
    return num;
  }     
  </code></pre>
  
  <p>Then I tried doing it like this, but it still doesn't work!</p>
  
  <pre><code>function FirstFactorial(num) { 
  
    if (num &lt; 0) {
      num = 0;
      console.log("You have to input a number!");
    }
  
    if (num === 0) {
      return 1;
    }
  
    return num * FirstFactorial(num - 1);
  }
  </code></pre>