+ 1
I'm confused about the JavaScript loops.
I need help. I'm trying to understand the JavaScript loops. But i can't. So i need someone who can teach me the loops.
7 Respuestas
+ 3
this last example loops 5 times.
First time: i=1
you write 1 onscreen.
Then variable i is incremented by 1, so now i=2
Second loop: i=2
you write 2 onscreen.
Then variable i is incremented by 1, so now i=3
etc etc
Total output is:
1
2
3
4
5
+ 1
Could you explain what about the loops is confusing to you? And make sure you take the course on JavaScript.
+ 1
I only see two kinds of loops here, and they are both for-loops. Are you confused about the syntax?
for (initialize variables; condition that controls the loop; increment variables)
+ 1
for (i=1; i<=5; i++) {
document.write(i + "<br />");
}
Here is another one
0
Zeke Williams
Here is my problem
Here is the 3 kinds of loops
I'm confused about them that how to write them
document.write(i + "<br />");
}
for (i=1, text=""; i<=12*4; i++) {
text = i;
document.write(i + "<br />");
}
var i = 0;
for (; i < 10; ) {
document.write(i);
i++;
0
Zeke Williams can you explain them
Please