Why We Use Loops
Loops repeat work so you do not have to.
Why We Use Loops is a free Javascript for Kids lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Javascript for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Loops? 🔁
Hi, loop explorer! 🌟 Imagine you have to say "hello" 100 times. Yawn! 😴
A loop lets the computer repeat work for us. So clever! 🪄
console.log("Hello!")
console.log("Hello!")
console.log("Hello!")Repeating is Boring by Hand 😮💨
Writing the same line over and over is slow and tiring.
Look how many lines just to say hi three times! There must be a better way. 🤔
console.log("Hi 1")
console.log("Hi 2")
console.log("Hi 3")Loops to the Rescue! 🦸
A loop does the repeating FOR you! You write it once and it runs many times.
It is like a magic copy machine! 🖨️
for (let i = 0; i < 3; i++) {
console.log("Hi from a loop! 👋")
}What is Inside a Loop? 🔍
The code inside the { } is what repeats!
The loop runs that code again and again. 🔂
for (let i = 0; i < 4; i++) {
console.log("Repeat me! 🔁")
}Loops Save Time ⏰
Want to print 5 stars? A loop does it super fast!
No typing the same thing 5 times. ⭐⭐⭐⭐⭐
for (let i = 0; i < 5; i++) {
console.log("⭐")
}Loops in Real Life 🌍
You use loops every day! Brushing each tooth, eating each candy in a bag, hopping on each step. 🦷🍬🪜
Doing the same thing many times IS a loop!
for (let i = 0; i < 3; i++) {
console.log("Hop! 🐰")
}Counting Hops 🐰
Loops can count! Each time around is called a turn or loop.
Let us count our hops. 🔢
for (let i = 1; i <= 3; i++) {
console.log("Hop number " + i)
}Feeding the Animals 🐶
Imagine feeding 4 puppies. A loop feeds them all!
One loop, four happy puppies. 🐶🐶🐶🐶
for (let i = 0; i < 4; i++) {
console.log("Feeding a puppy! 🦴")
}Too Many or Too Few? 🎚️
You control how MANY times a loop runs by changing one number!
Try changing the 3 to a bigger number. 🔢
for (let i = 0; i < 3; i++) {
console.log("Loop! 🔁")
}Loops and Patterns 🎨
Loops are great for making patterns, like rows of stars or hearts!
We will draw cool patterns soon. 💖
for (let i = 0; i < 5; i++) {
console.log("💖")
}Your First Loop 🧒
Make a loop that cheers! Change the number to cheer more or less.
You are a loop boss now! 🎉
for (let i = 0; i < 3; i++) {
console.log("Go team! 🎉")
}Quick Check ✅
Loopy question! You can do it! 🌀
Loop Explorer! 🏆
Fantastic! 🎉 Today you learned:
- Loops repeat work for us
- The code inside
{ }runs many times - You control how many times with a number
You are ready to loop! ⭐
for (let i = 0; i < 1; i++) {
console.log("I understand loops! 🎉")
}Frequently asked questions
Is the “Why We Use Loops” lesson free?
Yes — the full text of “Why We Use Loops” is free to read here on the web, and the Javascript for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Javascript for Kids course, upgrade to CoddyKit PRO.
What will I learn in “Why We Use Loops”?
Loops repeat work so you do not have to. You practise Javascript for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Javascript for Kids?
No prior experience is required. Javascript for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Why We Use Loops” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Javascript for Kids lesson?
Yes. Every Javascript for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.