Question 8
Back to Exercise
The code below stops with an uncaught error. Which statement correctly describes the problem?
for (const i = 0; i < 3; i++) {
console.log("Row", i);
}
- A It prints Row 0, then TypeError: i++ cannot reassign the const i – use let Correct
- B SyntaxError before anything runs
- C It prints Row 0, Row 1 and Row 2
- D It loops forever printing Row 0
Correct Answer: Option A
The first iteration runs normally; the update expression i++ then throws "Assignment to constant variable". A classic for loop needs let.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!