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 04
Fourth class. Budgeting is arithmetic: income minus expense, a savings percent, doubling an amount.
JS operators: + - * /. Order is school order: * and / before + and -. Use parentheses when you want a clear order: (income - expense) / 2.
Store the result in a variable:
const left = income - expense; console.log(left);
Mini example:
console.log(100 - 50);Common mistake: concatenating strings with + instead of adding numbers; or forgetting that division can return a decimal (10 / 4 → 2.5).
Operators + - * / work on numbers. Store the result or print it directly.
JS CONSOLE IDLE
›