Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

JS Numbers

JavaScript Numbers

JavaScript has a singular numeric data type, which can be expressed with or without decimal points.

Example

let x = 3.14;    // A number with decimals
let y = 3;       // A number without decimals

Very large or very small numbers can be represented using scientific (exponential) notation in JavaScript.

Example

let x = 123e5;    // 12300000
let y = 123e-5;   // 0.00123

JavaScript Numbers are Always 64-bit Floating Point

Unlike many languages, JavaScript doesn’t distinguish between number types like integers or floats. All numbers are stored as 64-bit double-precision floating-point values, following the IEEE 754 standard, with 52 bits for the fraction, 11 for the exponent, and 1 for the sign.

Value (aka Fraction/Mantissa)

Exponent

Sign

52 bits (0 – 51) 

11 bits (52 – 62)

1 bit (63)