+ 7
plz reply in simple words
i didnt understand anything in the loopššš plz tell me each things meaning that for what they are use and their function for (i=1; i<=5; i++) { document.write(i + "<br />"); } and this also šš for (i=1, text=""; i<=5; i++) { text = i; document.write(i + "<br />"); }
2 Answers
+ 6
The above will write to screen:
1
2
3
4
5
You could also re-write the for-loop above this way to make it more readable:
var i = 1;
while (i <= 5) {
document.write(i + "<br>");
i++;
}
so the value of i will be compared to the condition in the parenthesis (i <= 5), if it's true the code in the curly braces {.......} will run to write the value of i to screen. Then increment the value of i by 1, i++. Then the loop runs again and compare i to the condition until it's false.
+ 9
thanks
thank u very much Benšš
will you like to be my online teacher plz