Property | Description |
---|---|
EPSILON | The difference between 1 and the smallest number > 1. |
MAX_VALUE | The largest number possible in JavaScript |
MIN_VALUE | The smallest number possible in JavaScript |
MAX_SAFE_INTEGER | The maximum safe integer (253 - 1) |
MIN_SAFE_INTEGER | The minimum safe integer -(253 - 1) |
POSITIVE_INFINITY | Infinity (returned on overflow) |
NEGATIVE_INFINITY | Negative infinity (returned on overflow) |
NaN | A "Not-a-Number" value |
Number.EPSILON
is the difference between the smallest floating point number greater than 1 and 1.
Number.MAX_VALUE
is a constant representing the largest possible number in JavaScript.
Number properties belong to the JavaScript Number Object.
These properties can only be accessed as Number.MAX_VALUE
.
Using x.MAX_VALUE, where x is a variable or a value, will return undefined
:
Number.MIN_VALUE
is a constant representing the lowest possible number in JavaScript.
Number.MAX_SAFE_INTEGER
represents the maximum safe integer in JavaScript.
Number.MAX_SAFE_INTEGER
is (253 - 1).
Number.MIN_SAFE_INTEGER
represents the minimum safe integer in JavaScript.
Number.MIN_SAFE_INTEGER
is -(253 - 1).
let x = Number.POSITIVE_INFINITY;
Try it Yourself »
POSITIVE_INFINITY
is returned on overflow:
let x = 1 / 0;
Try it Yourself »
let x = Number.NEGATIVE_INFINITY;
Try it Yourself »
NEGATIVE_INFINITY
is returned on overflow:
let x = -1 / 0;
Try it Yourself »
NaN
is a JavaScript reserved word for a number that is not a legal number.
let x = Number.NaN;
Try it Yourself »
Trying to do arithmetic with a non-numeric string will result in NaN
(Not a Number):
let x = 100 / "Apple";
For a complete Number reference, visit our:
Complete JavaScript Number Reference.
The reference contains descriptions and examples of all Number properties and methods.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!