Example: Numbers
It is worth noting the following features:
- The number
1.23456789123456789123456789
is rounded off as not all the digits are stored. - There is no distinction made between the numbers
12.0
and12
. - The type of
NaN
isnumber
. - Due to numbers being stored as approximations, the result of
5.1 - 3.1
is neither2
nor2.0
, as one might expect. - Due to the existence of
Infinity
, dividing by zero does not result in an error. - The examples of addition, multiplication, and division show outputs without decimal points, even though there are inputs with decimal points.
- The second remainder operation illustrates another surprising consequence of numbers being stored as approximations.
You can change any example however you like in order to explore ideas further. If you want to return to the original example, use the Restore button.
Note:
Hints:
- undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
console.log(1.23456789123456789123456789);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX