isFinite()
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.
isFinite()
전역 함수는 주어진 값이 유한수인지 판별합니다. 필요한 경우 매개변수를 먼저 숫자로 변환합니다.
시도해보기
function div(x) {
if (isFinite(1000 / x)) {
return "Number is NOT Infinity.";
}
return "Number is Infinity!";
}
console.log(div(0));
// Expected output: "Number is Infinity!""
console.log(div(1));
// Expected output: "Number is NOT Infinity."
구문
js
isFinite(testValue);
매개변수
testValue
-
유한한지 판별할 값.
반환 값
설명
isFinite()
은 최상위 함수로 어떤 객체와도 연결되지 않았습니다.
숫자가 유한수인지 판별하기 위해 isFinite()
을 사용할 수 있습니다. isFinite()
은 주어진 수를 검사해 그 값이 NaN
, 양의 무한대, 또는 음의 무한대이면 false
를 반환합니다. 그렇지 않으면 true
를 반환합니다.
예제
isFinite()
사용하기
js
isFinite(Infinity); // false
isFinite(NaN); // false
isFinite(-Infinity); // false
isFinite(0); // true
isFinite(2e64); // true
isFinite(910); // true
isFinite(null); // true, would've been false with the
// more robust Number.isFinite(null)
isFinite("0"); // true, would've been false with the
// more robust Number.isFinite("0")
명세서
Specification |
---|
ECMAScript® 2025 Language Specification # sec-isfinite-number |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isFinite |
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.