JavaScript Foundations · Lesson 5 of 10

Conditionals

Learn how JavaScript can choose between two paths based on whether a condition is true or false.

Starter 4 practice exercises 1 homework item

What you will learn

  • Learn how JavaScript can choose between two paths based on whether a condition is true or false.
  • Recognize simple if and if/else patterns in tiny beginner examples.
  • Connect booleans and comparisons to simple code decisions.

Lesson shape

14 minute lesson with 11 sections, 4 exercises, 8 checkpoint questions, and 1 homework submission.

This track requires the Starter plan.

Lesson outline

What this lesson includes

This lesson is available with the Starter membership. Create an account to open the full student player, exercises, quiz, and completion tracking.

Overview

What you will learn in this lesson

Full lesson content unlocks in the student player.

Explain

What a conditional is in plain English

Full lesson content unlocks in the student player.

Explain

The simple if idea

Full lesson content unlocks in the student player.

Explain

The simple if/else idea

Full lesson content unlocks in the student player.

Practice

Tiny example 1: show one message if a user is logged in

Full lesson content unlocks in the student player.

Practice

Tiny example 2: react differently if a score is high enough

Full lesson content unlocks in the student player.

Practice

Tiny example 3: one path if a button was clicked and another if it was not

Full lesson content unlocks in the student player.

Explain

How conditionals connect to booleans and comparison operators

Full lesson content unlocks in the student player.

Explain

Separate the parts of a conditional

Full lesson content unlocks in the student player.

Explain

Common beginner mistakes with conditionals

Full lesson content unlocks in the student player.

Wrap up

Short recap before lesson 6

Full lesson content unlocks in the student player.

Homework

Assignments attached to this lesson

Short code response

Conditionals: quick check

Create a very small example or corrected snippet that demonstrates the main idea from Conditionals.

Not started

Open homework