While loop repeats last number when counting from 1 to 4

Why does this happen when I use a while loop ?

let counterTwo = 1;
while (counterTwo < 4){
console.log(counterTwo);
counterTwo++;
}

output I get is :

1 2 3 3

why does the 3 repeat at the end?

it doesn’t

edit: meant to ask why counterTwo++; repeat a 3 at the end?

The output for your logic is 1 2 3. You should not get anything else than this.

if you are getting an extra 3, double check your code… maybe there’s an extra “console.log(counterTwo)” down below.