Thanks to visit codestin.com
Credit goes to developer.mozilla.org

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Number.MIN_VALUE

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.

Number.MIN_VALUE 속성은 JavaScript가 표현할 수 있는 제일 작은 양의 숫자 값을 나타냅니다.

시도해 보기

function divide(x, y) {
  if (x / y < Number.MIN_VALUE) {
    return "Process as 0";
  }
  return x / y;
}

console.log(divide(5e-324, 1));
// Expected output: 5e-324

console.log(divide(5e-324, 2));
// Expected output: "Process as 0"
Property attributes of Number.MIN_VALUE
쓰기 가능불가능
열거 가능불가능
설정 가능불가능

설명

MIN_VALUE 속성은 JavaScript에서 표현할 수 있는, 0에 가장 가깝지만 음수는 아닌 수입니다.

MIN_VALUE의 값은 약 5e-324입니다. MIN_VALUE보다 작은 값("언더플로우 값")은 0으로 변환됩니다.

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

예제

MIN_VALUE 사용하기

다음 코드는 숫자를 두 개의 수를 받아 나누기 연산을 합니다. 만약 결과가 MIN_VALUE 보다 크거나 같으면 func1 함수를 호출하고, 그렇지 않으면 func2 함수를 호출합니다.

js
if (num1 / num2 >= Number.MIN_VALUE) {
  func1();
} else {
  func2();
}

명세

Specification
ECMAScript® 2027 Language Specification
# sec-number.min_value

브라우저 호환성

같이 보기