JavaScript Number Properties and Methods
JavaScript Number Properties
- These number methods can be used on all JavaScript numbers.
Property | Description |
---|---|
EPSILON | The difference between 1 and the smallest JS number. |
MAX_VALUE | The largest number possible in JavaScript |
MIN_VALUE | The smallest number possible in JavaScript |
MAX_SAFE_INTEGER | The maximum safe integer (25353 - 1) |
MIN_SAFE_INTEGER | The minimum safe integer -(25353 - 1) |
POSITIVE_INFINITY | Infinity (returned on overflow) |
NEGATIVE_INFINITY | Negative infinity (returned on overflow) |
NaN | A "Not-a-Number" value |
JavaScript EPSILON
- Number.EPSILON represents the difference between 1 and the smallest floating point number.
Sample Code
Output
JavaScript MAX_VALUE
- Number.MAX_VALUE is a constant representing the largest possible number in JavaScript
Sample Code
Output
Number Properties Cannot be Used on Variables
- Number properties belong to the JavaScript Number Object.
- Using a Number property on a variable, or value, will return undefined
Sample Code
Output
JavaScript MAX_SAFE_INTEGER
- Number.MAX_SAFE_INTEGER represents the maximum safe integer in JavaScript. Number.MAX_SAFE_INTEGER is (253 - 1).
Sample Code
Output
JavaScript MIN_SAFE_INTEGER
- Number.MIN_SAFE_INTEGER represents the minimum safe integer in JavaScript. Number.MIN_SAFE_INTEGER is -(253 - 1).