MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
Your Search Results

    Number.isFinite()

    This is an experimental technology, part of the ECMAScript 6 (Harmony) proposal.
    Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.

    Summary

    The Number.isFinite() method determines whether the passed value is a finite number.

    Syntax

    Number.isFinite(value)

    Parameters

    value
    The value to be tested for finiteness.

    Description

    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.

    Examples

    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')
    

    Polyfill

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

    Specifications

    Specification Status Comment

    ECMAScript 6 (ECMA-262)
    The definition of 'Number.isInteger' in that specification.

    Release Candidate Initial definition.

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support 19 16 (16) Not supported 15 Not supported
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support ? ? 16.0 (16) ? ? ?

    See also

    • The Number object it belongs to.

    Document Tags and Contributors

    Contributors to this page: Sheppy, fscholz, Mingun, ziyunfei, ethertank, imsaar, Waldo, maen78, nikhilm
    Last updated by: ziyunfei,