Consider following snippet:
 for (var Counter = 0; Counter < 10; Counter = Counter + 1) { Counter++; } 
How many times loop will execute the code?
Explanation
The variable Counter is available for modification within the loop: first loop: counter =0; counter = 0 +1; counter = 1+1 (counter ++); second loop: counter = 2; counter =2+1; counter = 3+1 (counter ++); ... fifth loop: counter: 8; counter = 8+1; counter = 9+1 (counter ++); So, loop will execute the code 5 times

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes