0
solve problem
Why the output is 6?! could you explain that to me, please?! var x = 0; while(x<6) { x++; } document.write(x);
1 Réponse
+ 4
0 < 6;
x++
x = 1
1 < 6;
x++
x = 2
2 < 6;
x++
x = 3
3 < 6;
x++
x = 4
4 < 6;
x++
x = 5
5 < 6;
x++
x = 6
6 < 6; // false
while loop exit
document.write (x)