Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

Lesson 5 of 55 · javascript

Control Flow – if / switch / loops

Duration: 10 mins

Conditional statements (if, else if, else) and switch for multi‑branch logic.

Looping constructs:

  • for (init; condition; final)
  • while (condition)
  • do … while (condition)
  • for…of – iterates over iterable objects.
  • for…in – iterates over enumerable property names.

Example: Looping over an array with for…of

const colors = ['red','green','blue'];
for (const c of colors) {
  console.log(c);
}
Previous: Operators & ExpressionsNext: Functions – declarations, expressions & arrow functions