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"
Property attributes of Number.MAX_VALUE
쓰기 가능불가능
열거 가능불가능
설정 가능불가능

설명

MAX_VALUE의 값은 약 1.79E+308, 2^1024입니다. MAX_VALUE보다 큰 값은 Infinity로 표현됩니다.

MAX_VALUENumber의 정적 속성이기 때문에, 직접 생성한 Number 객체의 속성이 아니라 Number.MAX_VALUE 형식으로 사용해야 합니다.

예제

MAX_VALUE 사용하기

다음 코드는 두 개의 수를 곱합니다. 만약 결과가 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 GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
MAX_VALUE

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

참고