Back to Lessons

Control Structures in JavaScript

April 5, 2026

Control Flow

Manage program execution with conditions and loops.

Control Flow Example

if (age >= 18) {
    console.log("Adult");
} else {
    console.log("Minor");
}

for (let i = 0; i < 5; i++) {
    console.log(i);
}

let numbers = [1,2,3,4,5];
numbers.forEach(num => console.log(num));

Key Points

  • if/else if/else for conditions.
  • Loops: for, while, do...while.
  • for...of, for...in for iteration.
  • break, continue control flow.