Pattern Printer
Build a printer.
Pattern Printer is a free Javascript for Kids lesson on CoddyKit — lesson 4 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.
Build a Pattern Printer! 🖨️
Hi, pattern pro! 🔢 Today we build a Pattern Printer! 🖨️
We will print fun shapes and patterns made of stars and numbers! Let's make some art with code! 🎨
Print a Star ⭐
Let's start simple. Print one star! ⭐
A pattern is just lots of these put together! 🌟
console.log('*');A Line of Stars ✨
Let's print a line of stars using a loop! ✨
The loop prints one star at a time, 5 times! 🔁
for (let i = 1; i <= 5; i = i + 1) {
console.log('*');
}Stars on One Line 📏
To put stars side by side, we build a string first! 📏
We add a star each time, then print the whole line! ➕
let line = '';
for (let i = 1; i <= 5; i = i + 1) {
line = line + '*';
}
console.log(line);A Growing Triangle 🔺
Now the magic! Let's make a triangle that grows! 🔺
Row 1 has 1 star, row 2 has 2 stars, and so on! 📐
for (let row = 1; row <= 5; row = row + 1) {
let line = '';
for (let star = 1; star <= row; star = star + 1) {
line = line + '*';
}
console.log(line);
}A Loop Inside a Loop! 🔁🔁
Wow! We used a loop INSIDE another loop! 🔁🔁
The outer loop makes rows. The inner loop makes stars in each row. Teamwork! 🤝
for (let row = 1; row <= 4; row = row + 1) {
let line = '';
for (let s = 1; s <= row; s = s + 1) {
line = line + '⭐';
}
console.log(line);
}A Number Pyramid 🔢
Let's print numbers instead of stars! 🔢
Each row shows the row number that many times! Fun pyramid! 🏔️
for (let row = 1; row <= 5; row = row + 1) {
let line = '';
for (let n = 1; n <= row; n = n + 1) {
line = line + row;
}
console.log(line);
}Counting Up Pattern 📈
Let's print rows that count up: 1, then 1 2, then 1 2 3! 📈
Such a cool staircase! 🪜
for (let row = 1; row <= 4; row = row + 1) {
let line = '';
for (let n = 1; n <= row; n = n + 1) {
line = line + n + ' ';
}
console.log(line);
}A Pattern Printer Machine 🛠️
Let's make a machine that prints a triangle of any size! 🛠️
Tell it how many rows, and it draws the triangle! 🔺
function printTriangle(size) {
for (let row = 1; row <= size; row = row + 1) {
let line = '';
for (let s = 1; s <= row; s = s + 1) line = line + '*';
console.log(line);
}
}
printTriangle(6);Make it Colorful 🌈
Let's use emojis to make our pattern colorful! 🌈
A rainbow triangle! Try changing the emoji! 🎨
function printTriangle(size) {
for (let row = 1; row <= size; row = row + 1) {
let line = '';
for (let s = 1; s <= row; s = s + 1) line = line + '🌈';
console.log(line);
}
}
printTriangle(5);You Built a Pattern Printer! 🏆
INCREDIBLE! 🏆 You finished the Number Patterns course!
- ✨ Build lines with a loop
- 🔁🔁 A loop inside a loop makes shapes
- 🔺 Triangles, pyramids, and staircases
You are a pattern artist now! 🎨
Quick Check ✅
Final brain check! 🧠 To make a triangle shape, what do we use?
Lesson Recap 🎀
Hooray, pattern artist! 🎀 You finished Number Patterns! You learned:
- ✨ Build a line of stars with a loop
- 🔁🔁 Nested loops make shapes
- 🔺 Triangles and pyramids
- 🌈 Add emojis for color
Amazing work! 🌟
Frequently asked questions
Is the “Pattern Printer” lesson free?
Yes — the full text of “Pattern Printer” 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 “Pattern Printer”?
Build a printer. 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 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Pattern Printer” 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.
All lessons in this course
- Even and Odd
- Skip Counting
- Multiplication Patterns
- Pattern Printer