JavaScript Number Properties

JavaScript provides several properties on the `Number` object that are useful for working with numerical values. These properties include constants for mathematical values and special number representations.

1. `Number.MAX_VALUE`

The `Number.MAX_VALUE` property represents the largest positive finite value that can be represented in JavaScript. It is approximately 1.7976931348623157 × 10^308.


// Example of Number.MAX_VALUE
console.log(Number.MAX_VALUE); // 1.7976931348623157e+308

    

2. `Number.MIN_VALUE`

The `Number.MIN_VALUE` property represents the smallest positive non-zero value that can be represented in JavaScript. It is approximately 5 × 10^(-324).


// Example of Number.MIN_VALUE
console.log(Number.MIN_VALUE); // 5e-324

    

3. `Number.NaN`

The `Number.NaN` property represents a special "Not-a-Number" value. It is used to indicate that a value is not a valid number.


// Example of Number.NaN
console.log(Number.NaN); // NaN
console.log(Number.NaN === NaN); // false (NaN is not equal to itself)

    

4. `Number.POSITIVE_INFINITY`

The `Number.POSITIVE_INFINITY` property represents positive infinity. It is a value that exceeds the maximum finite value in JavaScript.


// Example of Number.POSITIVE_INFINITY
console.log(Number.POSITIVE_INFINITY); // Infinity
console.log(1 / 0); // Infinity

    

5. `Number.NEGATIVE_INFINITY`

The `Number.NEGATIVE_INFINITY` property represents negative infinity. It is a value that is less than the minimum finite value in JavaScript.


// Example of Number.NEGATIVE_INFINITY
console.log(Number.NEGATIVE_INFINITY); // -Infinity
console.log(-1 / 0); // -Infinity

    

6. `Number.EPSILON`

The `Number.EPSILON` property represents the smallest interval between two representable numbers. It is used for precision comparisons of floating-point numbers.


// Example of Number.EPSILON
console.log(Number.EPSILON); // 2.220446049250313e-16