Hacker News new | ask | show | jobs
by jaywalk 1497 days ago
Just to be clear, because your comment made no sense to me: what IE11 doesn't support is Number.isNaN(). It definitely does support (and has since IE3) plain isNaN(): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
1 comments

Regular isNaN is very tricky, and almost never what you want: it first coerces its input to a Number, and then checks if that is NaN:

                isNaN   Number.isNaN
                -----   ------------
    {}           true          false
    [true]       true          false
    undefined    true          false
    "{}"         true          false
But none of those things you listed are numbers. The isNaN output is exactly what I want in pretty much every case.
isNaN does not tell you whether something is not a Number either. Applying isNaN to any of these returns false: null, true, false, [], "", "cabbage".