Infinite Loop
ELI5 — The Vibe Check
A loop that never stops running. It goes around and around forever because the exit condition is never met (or doesn't exist). Your fan spins up, your browser freezes, and you frantically mash Ctrl+C. Every developer has accidentally created one. It's a rite of passage.
Real Talk
An infinite loop is a loop construct that never terminates due to a missing or unreachable exit condition. It causes the program to hang, consume CPU, and become unresponsive. Common causes include off-by-one errors, incorrect loop conditions, and missing break statements.
Show Me The Code
// Accidental infinite loop
let i = 10
while (i > 0) {
console.log(i)
// Forgot: i--
}
// Your CPU: 🔥🔥🔥
When You'll Hear This
"The page froze — you've got an infinite loop somewhere." / "Ctrl+C! Ctrl+C! CTRL+C!!!"
Related Terms
Bug
A bug is anything in your code that makes it behave wrong.
Debug
Debugging is the process of finding and fixing the gremlins in your code. Something is broken, and you need to play detective — adding clues (console.
Loop
A loop makes your code do something over and over until a condition says stop.
Stack Overflow
A stack overflow happens when a function keeps calling itself forever, like a mirror facing a mirror.