- 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+", "); }

28th Oct 2017, 11:04 PM
Angela_g710
Angela_g710 - avatar
2 Answers
+ 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) + ", "); }
28th Oct 2017, 11:30 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
,Before, I did not return any results. Now if it works, thank you, ChaoticDawg!
28th Oct 2017, 11:43 PM
Angela_g710
Angela_g710 - avatar