Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
JAVASCRIPT FOUNDATIONS / CHAPTER 01 / Learn / LESSON 08
Eighth class. true/false alone do not print a status. if chooses a branch of code.
if (condition) { // runs only when the condition is true } else if (...) { ... } else { ... }
For budgets: if expense is under income → "ok"; if tight or over → "low" / "over".
Mini example:
if (3 < 5) { console.log("ok"); }
Common mistake: missing braces for multi-line bodies; or using = instead of === / <.
if runs a block only when the condition is true.
BUDGET STANDBY
›