Two types of numbers can be highlighted in modern JavaScript: Regular and bigInt.
 Regular ones are stored in the format of 64bit IEEE754. It is also known as “doubleprecision floatingpoint numbers”. Developers use these numbers most in their practice.
 BigInt numbers are used for representing integers of arbitrary length. We only use them in a few unique areas.
The Ways of Writing a Number
Let’s say you want to write one billion. This is the most common way:
let billion = 1000000000;
In our practice, we commonly try to keep away from writing many zeroes. We prefer to write, for example, "1bn". Now, we will learn how to shorten a number in JavaScript.
To shorten a number in JavaScript, you need to append the letter "e" to the number and specify the zeroes count. It will look like this:
Now, imagine you want to write “one microsecond”. You need to do it as follows:
let ms = 0.000001;
If you are eager to avoid writing a large number of zeros, you should act like this:
As 0.000001 includes 6 zeroes, it will be 1e6.
Hexadecimal, Binary and Octal Numbers
In Javascript, we use hexadecimal numbers, also known as Hex, for representing colors, encoding characters, and a lot more. Fortunately, there is a shorter way to write them:
0x and then the number.
Here is an example:
Here is an example of the octal numbers :
Generally, developers use binary and octal numeral systems more seldom. These numeral systems are also supported using the following prefixes: 0b and 0o.
For instance:
toString (Base)
This method returns a string representation of num, with a particular base, which can vary from 2 to 36. But the default is 10.
For example:
Rounding
A typical operation while working with numbers is rounding.
Below you can find several builtin functions used for rounding:
Math.floor
With the help of this function, you can easily round down. For example, 6.2 becomes 6, 2.2 becomes3.
Math.ceil
This function does the opposite. It rounds up the numbers. For example, 3.1 will become 4, 2.2 will become 2 .
Math.round
Using this function will round to the nearest integer. For instance, 3.1 becomes 3, 5.6 becomes 6, and 2.2 becomes 2.
Math.trunc
This function removes anything after the decimal point. For example, 6.1 will become 6.
Imprecise Calculation
In64 bit format IEEE754, there are 64 bits for storing a number. 52 of them are used for storing the digits, 11 of them  for the position of the decimal point, and 1 for the sign.
In case the number is too large, it will overflow the 64bit storage and will potentially give an infinity.
For better understanding, look at this example:
The loss of precision is also a common thing. Check out the following (falsy!) test:
Tests: isFinite and isNan
First of all, let’s check out the following two unique numeric values:
 Infinity (and Infinity). This numeric value is higher (less) than anything else.
 NaN shows an error.
It is vital to know that these are not standard numbers. Therefore, you need to use special functions to check for them.

The isNaN(value) converts its argument into a number. Afterward, tests whether it’s isNaN(value) or not.
 isFinite(value) will convert its argument to a number and return true in case the number is regular, not NaN/Infinity/Infinity.
For instance:
You can wonder why it is not possible to use the comparison of === NaN. Just because the NaN is unique in that will not equal anything, even itself:
Let’s have a look at this example:
There are cases when developers use isFinite for validating whether a string value is a regular number, like this:
ParseInt and ParseFloat
A numeric conversion that uses a + or Number() is strict. If a value is not exactly a number, it will fail as follows:
The spaces at the start or the end of the string are the only exception, as they are ignored.
By the way, in CSS, you can meet values in units, like "20pt" or "50px". Moreover, there are many countries where the symbol of the currency goes after the amount. For example, "19$". If you want to extract a numeric value out of it, you can use parseInt and parseFloat. These functions will read from a string to the point they can’t. If an error occurs, the number that has been gathered will be returned. The parseInt will return an integer, while parseFloat the floatingpoint number, as follows:
In some situations, parseInt and parseFloat functions will not return the NaN. It can happen when no digits are found. Check out the following example:
The parseInt() function has an alternative parameter which specifies the numeral system base. So, parseInt may parse the strings of hex numbers, binary numbers, etc: