Course contentsShow
← JavaScript
Lesson 100 of 2,7234. Working with NumbersFree lesson

JavaScript's Single Number Type

Learn that JavaScript uses IEEE 754 double-precision floats for all numbers, with no separate integer type.

JavaScript's Single Number Type

What you'll learn: Unlike many languages that have separate integer and floating-point types, JavaScript uses just one type for all numbers.

One Type to Rule Them All

In JavaScript, every number—whether it's 42, 3.14159, or -0.5—is stored internally as the same type: a double-precision 64-bit floating-point number (IEEE 754 standard). There's no distinction between integers and decimals at the language level.

typeof 42;        // "number"
typeof 3.14159;   // "number"
typeof -0.5;      // "number"
typeof 1000000;   // "number"

All of these return "number" because JavaScript doesn't have separate integer or float types.

What Does This Mean Practically?

Think of JavaScript's number system like a universal measuring tape that can measure both whole meters and fractions of millimeters—it's the same tool for everything. You don't need to specify "this is an integer" or "this is a decimal"; JavaScript handles all numbers uniformly.

let wholeNumber = 100;
let decimal = 100.0;

wholeNumber === decimal;  // true — they're identical

Even though 100 looks like an integer and 100.0 looks like a float, JavaScript treats them as exactly the same value because they're both stored as double-precision floats.

Why It Matters

This simplicity means you don't worry about type conversions between integers and decimals. However, it also means all numbers carry the precision characteristics (and limitations) of floating-point arithmetic—something we'll explore when discussing special values like NaN and Infinity.

Key Takeaway: JavaScript has only one number type—all numbers are IEEE 754 double-precision floats, whether they look like integers or decimals.