Lesson 7 — Loops
Loops
A for loop repeats a block a set number of times. You control it with three parts: where to start, how long to keep going, and how to step — for (let i = 0; i < 5; i++).
Why it matters: loops automate repetition, from counting to processing every item in an array.
Tip: to print even numbers, step by 2 (i += 2) or check i % 2 === 0 inside the loop.
Log even numbers 2..10.
Ready for more? These paid resources pick up where this lesson leaves off.
Project-based JavaScript Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →Hand-picked JavaScript Foundations books to master the fundamentals offline.
See on Amazon →Some links on this page are affiliate links: we may earn a commission at no extra cost to you. We only recommend tools we believe are genuinely useful.