← JavaScript Essentials

Lesson 2 of 3 · 9 min

Making decisions

if / else lets code choose a path: if (score >= 50) { pass() } else { retry() }.

Comparison operators like ===, > and <= produce true or false to drive those decisions.

Practice

Write an if/else that prints "Adult" when age is 18 or more, otherwise "Minor".

Quiz

+50 pts
1. Which checks strict equality?
2. else runs when the condition is…

Optional resources

Your lesson toolkit

No purchase or partner signup is required to complete this course or earn quiz points.

These are official product links, not active affiliate links. Learnly does not currently earn a commission from them.

Replit

Run your first JavaScript snippets in a browser workspace.

Free and paid plans; usage limits and feature availability vary.

Explore tool

MDN Web Docs

Look up JavaScript and DOM references while you practice.

Free documentation.

Explore tool