Utilizor
Contact Us

Infinite Loops

Avoiding infinite loops.

Infinite Loops

If you forget to increase the variable used in the condition, the loop will never end.

This will crash your browser.

Always ensure that the condition in a loop will eventually become false.

Example

// WARNING: This is an infinite loop
// while (true) {
//   console.log("Hello");
// }