Which fix removes the bug?
let count = 0;
while (count < 3) {
console.log(count);
}
- Add
count++inside the loop - Change
<to<=in the test - Start count at 1 instead of 0
- Use a for loop header instead
Without incrementing count, the loop never ends.
Play Problem Solving ▸