- 1
what am I doing wrong?
I want you to return all multiples of the number you enter but it does not work var x = prompt("Ingrese un numero"); for (i=1;i<=x;i++) { x*=i; document.write(x+", "); }
2 Respostas
+ 3
You're increasing both the value of x and the value of i in the for loop creating an infinite loop.
This might be more what you're looking for:
var x = prompt("Ingrese un numero");
for (i=1;i<=x;i++) {
document.write((x*i) + ", ");
}
+ 1
,Before, I did not return any results. Now if it works, thank you, ChaoticDawg!