Factorialize a Number help///

Hi, everyone. I’m having some trouble with this exercise. This is what I got so far. It’s throwing
syntax errors, so if someone could help me iron some of this out, I’d appreciate it! Thanks!

function factorialize(num) {
  if (num === 0) {
    return 1;
    } else (num < 0) {
    return "undefined";
    } else (num > 1) {
      for (i = num; i > 1; i--) {
        return i * (i - 1);
      }
    }
}
factorialize(5);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15.

Link to the challenge:

else doesn’t need a condition, it’s the falling for when the value didn’t satisfy any of the previous conditions. If you add a condition you need to use else if

1 Like

Thanks; that solved the syntax errors. But it’s still failing all of the tests, unfortunately. I took another look and have

function factorialize(num) {
  if (num === 0) {
    console.log(1);
    } else if (num < 0) {
    console.log("undefined");
    } else if (num > 1) {
      for (num; num > 1; num--) {
        console.log(num * (num - 1));
      }
    }
}
factorialize(5);

which at least returns things, evidently.