翻譯不完整。請協助 翻譯此英文文件

Number.isFinite() 方法會判斷傳入的值是否為有限數(finite number)。

語法

Number.isFinite(value)

參數

value
The value to be tested for finiteness.

回傳值

A Boolean indicating whether or not the given value is a finite number.

說明

In comparison to the global isFinite() function, this method doesn't forcibly convert the parameter to a number. This means only values of the type number, that are also finite, return true.

範例

Number.isFinite(Infinity);  // false
Number.isFinite(NaN);       // false
Number.isFinite(-Infinity); // false

Number.isFinite(0);         // true
Number.isFinite(2e64);      // true

Number.isFinite('0');       // false, would've been true with
                            // global isFinite('0')
Number.isFinite(null);      // false, would've been true with
                            // global isFinite(null)

Polyfill

Number.isFinite = Number.isFinite || function(value) {
    return typeof value === 'number' && isFinite(value);
}

規範

Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Number.isInteger' in that specification.
Standard Initial definition.
ECMAScript Latest Draft (ECMA-262)
The definition of 'Number.isInteger' in that specification.
Draft  

瀏覽器相容性

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
Basic supportChrome Full support 19Edge Full support YesFirefox Full support 16IE No support NoOpera Full support 15Safari Full support 9WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 16Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support 0.10

Legend

Full support  
Full support
No support  
No support

參見

文件標籤與貢獻者

此頁面的貢獻者: jackblackevo
最近更新: jackblackevo,