Help Please -- Factorialize a Number solutions review

Help Please -- Factorialize a Number solutions review
0

#1

I was able to get this test to work 2 ways by for loop and by doing while loop. Was feeling pretty good that I figured it out until I checked the Hint example page and saw I did it completely diferent than every one else.

Can any one point out any issues with the below solutions?

Solution #1:

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

factorialize(5);

=============================================

Solution #2:

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

factorialize(5);

#2

No, I don’t see any issue with it.
There are several solutions to a problem in coding, so it’s not like the wiki solution is the only one or the best one.
But it’s always good to know different solutions.