Loops in JavaScript

Switch-AnweisungIterierbare & for...of

Loops allow you to repeat a block of code multiple times. This is essential for tasks like processing lists, counting, or waiting for conditions.

JavaScript has several loop types, each suited to different situations. We'll cover them all with clear examples.

The for Loop

The most common loop when you know how many times to repeat. It has three parts: initialization, condition, increment.

while Loop

Runs as long as the condition is true. Check the condition before each iteration.

do-while Loop

Similar to while, but the code runs at least once – condition checked after.

break and continue

break exits the loop entirely. continue skips to the next iteration.

Looping Over Arrays

for loop with index or modern for...of/for...in (covered in next lesson).

Infinite Loops (Be Careful!)

Avoid loops without proper exit condition.

Quick Quiz

Wir haben die Materialien überprüft, dennoch können Fehler vorkommen. Der Inhalt dient ausschließlich Bildungszwecken, daher verwende ihn auf eigene Verantwortung und überprüfe ihn bei Bedarf mit anderen Quellen.

✨ Frag Lara — deine KI-Lernpartnerin

Entsperre personalisierte Lernunterstützung. Lara kann Lektionen erklären, Themen zusammenfassen und deine Lernfragen beantworten — verfügbar ab dem Go-Tarif.


Lara hilft dir, schneller zu lernen — exklusiv für ReadyTools Go-, Plus- und Max-Mitglieder.

Verfolge deinen Fortschritt 🚀

Lerne einfacher, indem du deinen Fortschritt kostenlos verfolgst.