Skip to main content

Numeric Data Types

Numbers are the most basic data type; they require very little explanation. JavaScript differs from programming languages such as C and Java in that it does not make a distinction between integer values and floating-point values.

All numbers in JavaScript are represented as floating-point values. JavaScript represents numbers using the 64-bit floating-point format defined by the IEEE 754 standard, which means it can represent numbers as large as 1.7976931348623157 x 10308 and as small as 5 x 10-324.

This format should be familiar to Java programmers as the format of the double type. It is also the double format used in almost all modern implementations of C and C++.

When a number appears directly in a JavaScript program, it's called a numeric literal.

JavaScript supports numeric literals in several formats.

Note that any numeric literal can be preceded by a minus sign (-) to make the number negative.

Next: Operators