What in the world is making the second parameter return true?
WARNING: it will loop infinitely and might crash your browser
for(;;){
//...
}
I was totally expecting not to loop at all…
But it is running, and that makes it worse since it can only be running if something evaluated to true, or am I missing something?
From
forMDN[Initialization]and[final-expression]are intuitively not required, reducing the construct to a simplewhileloop. But the relevant part is:(emphasis mine)
This appears to be a totally arbitrary JS language design decision. If it were my language I would probably throw a syntax error.
On a playful side note,
for(;;){}is equivalent towhile(true){}, and happens to be 4 characters shorter. I wonder if minifiers leverage this!