An isFinite function is added to the Number constructor. It could be implemented as this:

(function (global) {
    var global_isFinite = global.isFinite;
    Object.defineProperty(Number, 'isFinite', {
        value: function isFinite(value) {
            return typeof value === 'number' && global_isFinite(value);
        configurable: true,
        enumerable: false,
        writable: true

This is better than the global isFinite because it is not confused by type coercion.

Douglas Crockford 2010/12/15 20:22Brendan Eich 2011/04/28 00:19

harmony/number.isfinite.txt · Last modified: 2011/04/28 00:54 by brendan
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki