0
Output is different due to i++ position but why ?
var i = 8; while ( i <= 19){ document.write(i + "</br>") i++; } /* output: 8 9 10 11 12 13 14 15 16 17 18 19 */ var i = 8; while ( i <= 19){ i++; document.write(i + "</br>") } /* output: 9 10 11 12 13 14 15 16 17 18 19 20 */ https://code.sololearn.com/W2HJ2Vf4K5rz/?ref=app
3 Respostas
+ 6
In first loop you print <i> value then you increment <i> value.
In second loop you increment <i> value, then you print <i> value.
+ 4
Coder In the first condition
After the document.write i is incrementing that's why it starts printing 8 to till 19
In the second condition
After the while condition i is incrementing that's why it starts with 9 ends with 20