By the end of this class, students will be able to:
A loop lets you run a block of code multiple times — until a condition is false.
Without loops, you’d have to repeat the same code again and again!
📘 Example (Without Loop):
console.log("Hello");
console.log("Hello");
console.log("Hello");
console.log("Hello");
console.log("Hello");
😩 Boring, right?
📘 Example (With Loop):
for (let i = 1; i <= 5; i++) {
console.log("Hello");
}
✅ Cleaner, faster, easier to update.
for LoopUsed when you know exactly how many times something should repeat.
📘 Syntax:
for (initialization; condition; increment/decrement) {
// code to repeat
}