Loop Count
Predict Output Easy
Question
What does this code print?
Code
let c = 0;
for (let i = 0; i < 3; i++) c++;
console.log(c);
Hint
The loop runs 3 times (i=0,1,2).
Explanation
The loop iterates with i = 0, 1, 2 (3 iterations). Each iteration increments c. So c becomes 3.
Related Resources
Related Lessons
- Loops
Learn JS loops.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.