basically it’ll only start complaining when your tokens stop being tokens. Or more specifically, when it interprets your tokens as multiple other tokens:
document.wr ite("thing")
is going to cause a problem because “ite” is an unexpected identifier at that point.
This is still valid syntax. It’s an infinite loop, but it’s valid syntax. It says “While the value of balls is greater than 0, do nothing, and go back to the beginning of this sentence.”