INTERACTIVE COURSE · FREE

Conditionals in JavaScript: deciding, selecting, and checking

Learn if, else, else if, compound conditions, nesting, switch, and the ternary operator. Build readable decisions and check registrations and discounts through scenarios and boundaries.

Level
Beginner
Lessons
5
Learning steps
78
UNDERSTAND · PRACTISE · APPLY

Your lesson journey

Each lesson has a purpose. Follow the order or revisit an idea you want to practise.

5 lessons

5 of 5 lessons shown

The numbers show the lesson order, not your progress.

What you will learn

Distinguish evaluating a condition from executing actions according to its result. Implement if and else with braces and alternative messages and check both paths. Use else if chains, order overlapping cases, and detect redundant or unreachable branches. Compare compound conditions and nested decisions while preserving problem rules. Select specific values with switch and explain break and fall-through. Use a simple ternary as an expression producing a value. Design and test typical scenarios, rejections, and boundary values. Build registration with categories and discounts, calculate prices only when appropriate, and justify and correct decisions.

Before you start

Complete courses 01 through 07 of Programming Fundamentals or know their contents. Assumes let, const, basic types, console.log, strict comparisons, logical operators, precedence, blocks, and desk checks. No formal conditional-structure experience is required. Uses valid fictional inputs of known types without forms or installations.

COURSE CONTEXT

About this course

Read the full description

Course 08 of Programming Fundamentals from Código con Criterio. Building on previously studied boolean expressions, it teaches choosing instructions and values according to data. Across five lessons, you will progress from two paths to a small registration-and-discount system.

Codi guides explanations, text decision diagrams, executable references, scenarios, activities with hints, and labs. The progression introduces if and else, else if chains, compound and nested conditions, switch, and a simple ternary.

Practice covers inclusive boundaries, first matches, redundant or unreachable conditions, equivalent versions, and deliberate errors. break is used only in switch to explain fall-through. Coercion and advanced validation are not explored in depth.

The challenge explicitly defines requirements and categories and calculates prices only for accepted registrations. It includes a complete reference, scenario table, and a discount chain with an ordering error. Activities check understanding; free-form code and personal explanations are not automatically corrected.

No installations, loops, custom functions, arrays, objects, or asynchronous programming are required. Programs are independent; use a new context if your tool retains earlier declarations.

CONNECT YOUR LEARNING

This course is part of these learning paths

Follow the suggested order or take this course on its own.