+ 6
What is the output of this code? for (var i = 5; i <9; i++) {document.write (9-i);}
I got the output 4321. How is it possible? for (var i = 5; i <9; i++) {document. write (9-i);} ¿
2 Antworten
+ 13
i starts at 5 and ends with 8 (<9), so
9-5 = 4
9-6 = 3
9-7 = 2
9-8 = 1
+ 6
< terminates the loop when var reaches a value just less than specified.
<= alliws dor the option to use the limit value.
Basically, school math