I'm not sure what answer you're expecting, but to me that's exactly what I'd expect the counter to get.
Remember, you're not reverting "counter" back to 0 after you do the loop, so every time the "counter" variable counts to ten, ends the loop, then posts the number it has, which is 10.
When you call the loop to go through, it doesn't change the number because the "if" statement sees that "counter" is already 10, and will post the console.log statement again.
HOWEVER, you're teetering dangerously on a endless loop, because if you call the "loop" twice, it'll reach the number "11" and will count up forever because it can never again be equal to "10".
Otherwise the bool or Boolean, is a true / false only, so "while(bool)" is the same as saying "while(bool == true)". If it's not true, or you change bool to false, then it will not run the loop, and the console.log statement will say "0" twice, since both console.log statements are outside of the while loop.
I know this is complicated, but you're simply overcomplicating it for yourself. So just take a step back and look at what you're trying to accomplish with this, and figure out what steps you need to get there.
I hope this helps!