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 12
Twelfth class — Foundations finale. You combine remaining and status into a tiny budget API.
function remaining(income, expense) { return income - expense; }
function budgetStatus(income, expense) { const left = remaining(income, expense); if (left > 0) return "ok"; // ... }
The harness will call remaining(3000, 1200) and budgetStatus(3000, 1200). Expect 1800 and status "ok".
Common mistake: printing the status but not returning it — the checker reads the return value.
budgetStatus uses remaining and returns a status string. Constants will fail.
BUDGET STANDBY
›