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