+ 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 Antworten
+ 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