0
Need help with loops
Code1 for(x=0; x<6; x++){ document.write(x) } output => 012345 Code2 for(x=0; x<6; x++){ } document.write(x) output =>6 Why is the output 6 but not 5 in the second code?
2 Answers
+ 4
â
_â
_â
Because in second loop after checking 5 < 6, x will be increment by 1 for next checking.
So now x is 6 but 6 < 6 is false so x will not be increment by 1 so finally x will be 6
+ 1
Maybe bcuz in the second code u wrote the document.write element outside the {} with the for element