For-Loops: The Shell of Madness

Wherein lies the secret to looping like a pro?

Here, we'll dive into the depths of Forever Loops, where the loop never ends.

Basic For Loop

For loops: the most common form of loop, where you loop over an iterable like a fish in a barrel.

for (let fish in fishTank) {
  console.log(fish.name);
}

For-Ever Loops

Where the loop never ends... or does it?

for (let i = 0; i < 10 ** 100; i++) {
  console.log(i);
  // This will never end...
}

Want more examples? Check out our For-Loop Examples page for more fishy fun!