I'm trying to return the factorial of the provided integer. When doing it like this, e.g:
factorialize(num) {
for (var i = 1;i <= num; i++){
num*=i;
}
return num;
}
factorialize(5);
I'm getting an infinite loop. While I understand that this shouldn't give me the correct answer because my understanding of it would go something like this:
n! = 5 * 1 * 2 * 3 * 4 * 5 = 600
when really it should go:
n! = 1 * 2 * 3 * 4 * 5 = 120
But still, I don't understand why I am getting an infinite loop here?
