Number.MAX_VALUE
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Number.MAX_VALUE
静的データプロパティは、 JavaScript において表すことが可能な最大の数値を表します。
試してみましょう
function multiply(x, y) {
if (x * y > Number.MAX_VALUE) {
return "Process as Infinity";
}
return x * y;
}
console.log(multiply(1.7976931348623157e308, 1));
// Expected output: 1.7976931348623157e+308
console.log(multiply(1.7976931348623157e308, 2));
// Expected output: "Process as Infinity"
値
21024 - 1、またはおよそ 1.7976931348623157E+308
です。
Number.MAX_VALUE のプロパティ属性 | |
---|---|
書込可能 | 不可 |
列挙可能 | 不可 |
設定可能 | 不可 |
解説
例
MAX_VALUE の使用
以下のコードは、2 つの数値を掛け算しています。その結果が MAX_VALUE
より小さいか等しい場合は、func1
関数が呼び出されます。それ以外の場合は、func2
関数が呼び出されます。
js
if (num1 * num2 <= Number.MAX_VALUE) {
func1();
} else {
func2();
}
仕様書
Specification |
---|
ECMAScript® 2025 Language Specification # sec-number.max_value |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MAX_VALUE |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
Number.MIN_VALUE
- 所属先の
Number
オブジェクト