Caffeinated Coder
Book an appointment
Lesson 06 · Basics

Loops

A loop runs the same lines again and again. Follow a five-line for loop that adds 1, 2 and 3: the start runs once, the check i <= 3 runs before every round, the body adds i to total, i++ runs after every round, and when the check turns false the loop ends and console.log prints 6.

9 min10 steps5 questionsBeginner
Fig 6 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.