number (type)

The type of ordinary numeric values in JavaScript, both whole numbers and decimals, stored as 64-bit floating-point numbers.

In more detail

Because of the floating-point format, whole numbers are only exact up to Number.MAX_SAFE_INTEGER, and decimals such as 0.1 + 0.2 are slightly off. Use bigint for larger integers and whole units such as cents for money.

Related terms

Taught in

References