0

js

for (i = 0; i <= 10; i++) { if (i == 5) { break; } document.write(i + "<br />"); } how this code work

18th May 2019, 4:49 PM
Mewan Athukorala
Mewan Athukorala - avatar
1 Answer
+ 2
If the code wouldn't include the break, it would print out all the numbers from 0 to 10. But because it is there, when i equals five, the code breaks, so it prints out the numbers from 0 to 4. Also, you could've made the question in your first post, please dont spam
18th May 2019, 4:54 PM
Airree
Airree - avatar