I have a question, I found the following code to calculate the factorial number of a whole number, but I am doing my desktop run and I can not understand the code because it is assumed that in the process of the factorial it multiplies by all the numbers that are given before the number to be calculated, and the only answer that I find to the following code is that in the variable "result" I will store the value of the multiplication and that multiplies it by "i" up to 5 and there the cycle ends, but I'm not sure if what I think is correct, I leave the code and I hope you can help this neophyte.
var numero = prompt("Introduce un número y se mostrará su factorial");
var resultado = 1;
for(var i=1; i<=numero; i++) {
resultado *= i;
}
alert(resultado);