Factorialize a Number - I think my code is correct?

Tell us what’s happening:
As far as I can tell, this program works fine. I’ve tested all the conditions, and it gives the correct answer. Yet, when I submit the code, for some reason it says it fails all conditions but the first.

Can anyone confirm whether or not this could DOES do the factorial function, and if so, any advice for getting the site to recognize the code as working?

EDIT: Apparently the first line of code didn’t copy over. It’s var factorial = 1

Putting that into the function instead of outside seems to have mitigated the problem somewhat.

Your code so far

function factorialize(num) {
  if (num == 0) {
    return 0;
  }
  for (var i = 1; i <= num; i++){
    factorial *= i;
  }
    return factorial;
}

factorialize(20);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393.

Link to the challenge:

You should have var factorial = 1 inside the function, so as not to pollute the global workspace. Other than that, take another look at your if statement’s return to pass the factorialize(0) test case.