0Pricing
Javascript for Kids · Lesson

Counting Down

Loop backwards.

Blast Off! 🚀

5... 4... 3... 2... 1... LIFTOFF! 🚀

That is counting DOWN! The numbers get SMALLER. Today we make loops count backwards.

Flip the Loop 🔄

To count down, we change 3 things:

  • Start big (like 5)
  • Keep going while i >= 1
  • Step with i-- (subtract 1!)
for (let i = 5; i >= 1; i--) {
  console.log(i)
}

All lessons in this course

  1. Counting Up
  2. Counting by Steps
  3. Counting Down
  4. Number Patterns
← Back to Javascript for Kids