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);
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.
Thanks Kev, that was really bugging me.
kevcomedia, this solved my problem as well - thanks!