0Pricing
Javascript for Kids · Lesson

Counting with a for Loop

Count from one number to another.

Counting with for 🔢

Hi, counting captain! 🌟 The for loop is great for counting!

It can count 1, 2, 3 all by itself. 🪄

for (let i = 1; i <= 3; i++) {
  console.log(i)
}

The Three Parts 🧩

A for loop has three parts inside ( ):

  • Start: where to begin
  • Rule: when to keep going
  • Step: how to count up
for (let i = 0; i < 3; i++) {
  console.log("Step!")
}

All lessons in this course

  1. Why We Use Loops
  2. Counting with a for Loop
  3. Repeating with while
  4. Drawing Patterns with Loops
← Back to Javascript for Kids