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

Number Constants: MIN_VALUE, MAX_VALUE

Explore Number.MIN_VALUE (smallest positive number) and Number.MAX_VALUE (largest representable number).

Number Constants: MIN_VALUE, MAX_VALUE

You'll learn about JavaScript's built-in constants that represent the extreme boundaries of the number type.

The Outer Limits of JavaScript Numbers

JavaScript provides two special constants that tell you the range of numbers you can work with: Number.MIN_VALUE and Number.MAX_VALUE. These aren't arbitrary values—they're determined by how JavaScript stores numbers internally using the IEEE 754 double-precision floating-point format.

Number.MAX_VALUE represents the largest positive number JavaScript can handle—approximately 1.7976931348623157e+308. Try to go beyond this, and you'll get Infinity.

Number.MIN_VALUE is trickier: it's the smallest positive number JavaScript can represent—approximately 5e-324. This is very close to zero, but not quite zero. Think of it as the tiniest sliver above zero that JavaScript can distinguish from zero itself.

Understanding MIN_VALUE

A common mistake is thinking MIN_VALUE is the "most negative" number. It's not! It's the smallest positive number. The most negative number you can represent is actually -Number.MAX_VALUE.

console.log(Number.MAX_VALUE);     // 1.7976931348623157e+308
console.log(Number.MIN_VALUE);     // 5e-324

console.log(Number.MAX_VALUE * 2); // Infinity (exceeded maximum)
console.log(Number.MIN_VALUE / 2); // 0 (too small to represent)

Think of it like a ruler: MAX_VALUE is the farthest mark to the right, while MIN_VALUE is the finest, most precise tick mark you can make just barely above zero.

Key Takeaway: Number.MAX_VALUE represents the largest possible number (~1.8e+308), while Number.MIN_VALUE represents the smallest positive number (~5e-324) JavaScript can handle.