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

Number.MAX_VALUE and MIN_VALUE

Explore the largest and smallest positive numbers JavaScript can represent.

Number.MAX_VALUE and MIN_VALUE

What you'll learn: The absolute limits of positive numbers JavaScript can represent.

The Boundaries of JavaScript Numbers

JavaScript can't store infinitely large or infinitely small numbers. There are specific upper and lower boundaries for positive values it can represent. These boundaries are stored as constants on the Number object: Number.MAX_VALUE and Number.MIN_VALUE.

Number.MAX_VALUE

Number.MAX_VALUE represents the largest positive number JavaScript can handle before it becomes Infinity. It's approximately 1.7976931348623157e+308 (that's 308 zeros!).

Think of it as the ceiling of a room—if you try to reach higher, you're no longer inside the room. Any calculation exceeding this value becomes Infinity:

console.log(Number.MAX_VALUE);  // 1.7976931348623157e+308
console.log(Number.MAX_VALUE * 2);  // Infinity

Number.MIN_VALUE

Despite its name, Number.MIN_VALUE is not negative. It represents the smallest positive number JavaScript can represent—approximately 5e-324. This is the closest you can get to zero while still having a positive value.

Think of it as the thinnest slice you can cut before it disappears entirely:

console.log(Number.MIN_VALUE);  // 5e-324
console.log(Number.MIN_VALUE / 2);  // 0 (underflows to zero)

Why This Matters

These constants help you understand the practical limits of number operations. Going beyond MAX_VALUE produces Infinity, while going below MIN_VALUE underflows to zero.

Key Takeaway: Number.MAX_VALUE is the largest positive number (~1.8e+308), and Number.MIN_VALUE is the smallest positive number (~5e-324) JavaScript can represent—not the most negative number!