Factorialize a Num

My Code is not returning 1 when the parameter is 0:

Your code so far

function factorialize(num) {
let factorial = num;
  for (let i = 1; i < num; i++) {
      factorial = factorial * (num - i);
  return factorial;


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.

Link to the challenge:

you are returning 0, the loop doesn’t execute because i < num (1 < 0) is false
and you just return num

you need to change something or add something for when num is 0

1 Like

Figured it out. Thanks.