My code for factorialize a number algorithm

My code for factorialize a number algorithm
0

#1

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);



#2

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


#3

Thanks Kev, that was really bugging me.


#4

kevcomedia, this solved my problem as well - thanks!