Quote (bail6002 @ Jan 14 2013 11:38am)
Okay but then I have an other question. Why do we include x? Like what is the purpose of the second x?
Code
x="Trololo The number is " + i + "<br>";
Shouldn't this code do the job?
Because of this line:
Code
document.getElementById("demo").innerHTML=x;
You replace that paragraph with x.
If you don't append to X, you only display the last line of the for loop which would be
Code
"Trololo The number is 2 <br>"
This post was edited by DirtyRasa on Jan 14 2013 02:34pm