>_BeginnerCoder
Donate

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.

Task

Log even numbers 2..10.

← Back
Next →

Enjoying this lesson? Share it 👇

Keep going with JavaScript Foundations

Ready for more? These paid resources pick up where this lesson leaves off.

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.