+ 8
In the code below, what does "i" mean and is it compulsory to use it?
for (i=1; i<=5; i++) { document.write(i + "<br />"); }
4 Respuestas
+ 10
it's use for iteration. though you can you use any letters you like but it would be easier to recall "i" for iteration. 😊
+ 6
'i' is the iterator of the for-loop.
It has an initial value of '1'.
This value will be increased by '1' every time the loop is running trough and til the condition (i<=5) is true.
+ 5
btw be carefull If you use nested loops and make sure that you usw different variables for each loop
+ 2
"i" is variable name defined by FOR loop. You can use any other name for this variable.