Numbers

Alim Mondal
May 5, 2021

ECMAScript has two built-in numeric types: Number and BigInt.

The Number type is a double-precision 64-bit binary format IEEE 754 value (numbers between -(253 − 1) and 253 − 1). And where this article and other MDN articles refer to “integers”, what’s usually meant is a representation of an integer using a Number value. But because such Number values aren’t real integers, you have to be a little careful. For example:

console.log(3 / 2);             // 1.5, not 1
console.log(Math.floor(3 / 2)); // 1

So an apparent integer is in fact implicitly a float.

--

--