I'm a beginner learning loops.
I made a for loop like this:
for (i = 0; i < 5; i++) {
console.log("Counting...");
}
As expected I get the output "Counting..." five times.
I modified the loop and put the counter inside it instead (maybe you shouldn't do this, I'm just trying things out).
for (i = 0; i < 5;) {
console.log("Counting...");
i++
}
Now i get:
Counting...
Counting...
Counting...
Counting...
Counting...
4
Where is this 4 coming from? What does it mean?
4that gets printed: fiddle. You must have anotherconsole.logsomewhere after."Counting..."five times followed by anundefinedin the first case?4