Numbers, Math, and Dates
Convert and validate numbers, avoid common floating-point mistakes, and perform reliable calculations.
Lesson introduction
JavaScript uses IEEE 754 double-precision numbers for most numeric work. Reliable programs convert boundary input once, validate finiteness and range, and choose representations that match the domain.
Where this fits
This lesson builds one part of the path from language fundamentals to complete browser applications.
What you will build
Create a cart calculation in integer cents with validation for price and quantity.
You will first study the underlying rule, then trace worked code, repair a mistake, and create an independent solution.