Lesson 4 of 10

Core Logic

Lesson 4: Loops (Coming Soon)

Loops help you repeat code. Before we learn loop syntax, we first train your thinking so loops feel easy.

Learning Goals

Why Loops Matter

If you print 3 messages, manual code is okay. If you print 100 messages, manual code is stressful.

console.log("Intern report 1");
console.log("Intern report 2");
console.log("Intern report 3");
console.log("Intern report 4");

When we write this repeatedly, we mean we are doing the same task many times. A loop will help us automate this in the next lesson.

Pattern Thinking Practice

Before coding loops, practice spotting the pattern:

Loop mindset: identify change + identify repeat count.

Deeper Explanation

This lesson is intentionally a thinking lesson, not a syntax lesson. Many beginners struggle with loops because they jump into for and while before understanding repetition patterns. We are avoiding that trap. First, you train your eyes to see what repeats, what changes, and when repetition should stop.

When this mindset is strong, loop syntax becomes simple typing instead of confusion. You will not memorize loops blindly; you will understand why they exist and when to use them. That is the goal of this preparation step.

Preparation Exercise (No Loop Yet)

  1. Write 5 console.log lines manually for "Day 1" to "Day 5".
  2. Circle the part that changes in each line.
  3. Explain in one sentence how a loop would help.

Homework

Create a file named repeat-thinking.js and manually print "Task 1 complete" up to "Task 8 complete". In a comment, describe how a loop would reduce the code.

Answer Guide
console.log("Task 1 complete");
console.log("Task 2 complete");
console.log("Task 3 complete");
console.log("Task 4 complete");
console.log("Task 5 complete");
console.log("Task 6 complete");
console.log("Task 7 complete");
console.log("Task 8 complete");

// A loop can run one block many times instead of writing each line.
← Previous Lesson Next Lesson →