Numbers
JavaScript has only one type of number – 64-bit float point. It's the same as Java's double
. Unlike most other programming languages, there is no separate integer type, so 1 and 1.0 are the same value. Creating a number is easy, it can be done just like for any other variable type using the var
keyword.
Numbers can be created from a constant value:
Or from the value of another variable:
The precision of integers is accurate up to 15 digits and the maximum number is 17.
It interprets numeric constants as hexadecimal if they are preceded by 0x
.
Last updated
Was this helpful?