My code for factorialize a number algorithm

My code seems to output all of the correct answers, yet its not passing the test…any ideas here?

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

factorialize(5);


Global variables are not accepted for some reason. Just move var product inside the function.

1 Like

Thanks Kev, that was really bugging me.

1 Like

kevcomedia, this solved my problem as well - thanks!