Obnoxious JavaScript Techniques: 2-While Loop of Woes
Warning: the following code may cause seizures, headaches, or spontaneous combustion. Proceed with caution.
// 2-While Loop of Woes
while (true) {
console.log("I'm stuck in an infinite loop!");
if (Math.random() < 0.5) {
console.log("But I'll only print every other iteration.");
}
}
Caution: This loop may not actually end, and you might need to use the 'Alt+Tab' trick to escape.
Buy me an out-of-loop rescue team!
Or, you know, just try to debug it yourself.