Services Work Learn About Contact
0/10
Lesson 4 of 10

Loops

Loops repeat code. A for loop runs a specific number of times. A while loop runs while a condition is true. A for...of loop iterates over arrays.

JS
// For loop
for (let i = 0; i < 5; i++) {
  console.log(i); // 0, 1, 2, 3, 4
}

// While loop
let n = 0;
while (n < 3) {
  console.log(n);
  n++;
}
🧠

Quick Quiz

Answer correctly to unlock the next lesson.

Support the mission

This learning platform is 100% free: no ads, no tracking, no paywalls. If it helped you learn something useful, you can support future lessons or donate to Doctors Without Borders, which provides emergency medical care in crisis zones worldwide.

🎉

You completed JavaScript!

You finished all 10 lessons and quizzes. You now know the basics of JavaScript.