# JavaScript Level 2: Program Flow

> Level 2: Program Flow of the LoWisa JavaScript course: Conditions and Boolean Logic, Loops and Iteration, Control Flow and Program Decisions. 3 lessons and 9 ideas, each explained in one line.

Program Flow is level 2 of 16 of the [LoWisa JavaScript course](/courses/javascript/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Conditions and Boolean Logic

- **The if statement.** An **if** statement runs its block only when its condition is true, and else catches every other case.
- **Comparisons.** Comparison operators like === and < produce a **boolean**, which is what an if statement actually reads.
- **Combining conditions.** The && operator needs both sides true, || needs either, and the not operator **flips** a condition to its opposite.

## Loops and Iteration

- **The for loop.** A **for** loop repeats a block a controlled number of times: start, check, step, all declared up front.
- **The while loop.** A **while** loop repeats as long as its condition stays true: and loops forever if you never change it.
- **for...of.** The for...of loop walks the **elements** of an array directly, so you handle each item without counting indexes.

## Control Flow and Program Decisions

- **Early return.** Handling the failing case first and leaving early keeps code flat: a **guard** clause instead of nested ifs.
- **switch.** A **switch** statement picks one branch from many by matching a value against cases, with break ending each branch.
- **Tracing flow.** To predict a program you **trace** it: follow the exact order lines run in, keeping each variable on paper.

## Before and after this level

- **Before:** [Level 1: JavaScript Foundations](/courses/javascript/level-1-javascript-foundations/): Values, Variables and Operators, Expressions and Basic Types, Reading and Writing JavaScript.
- **Next:** [Level 3: Functions & Scope](/courses/javascript/level-3-functions-and-scope/): Functions, Parameters and Returns, Scope, Closures and Lexical Environment, Callbacks and Higher-Order Functions.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does JavaScript Level 2: Program Flow cover?

Conditions and Boolean Logic, Loops and Iteration, Control Flow and Program Decisions: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 1: JavaScript Foundations, which covers Values, Variables and Operators, Expressions and Basic Types, Reading and Writing JavaScript.

## Learn JavaScript on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/javascript/level-2-program-flow/ · Updated 2026-11-16
