jasnell / proposal-istypes

TC-39 Proposal for additional is{Type} APIs
201 stars 7 forks source link

add NaN.isNaN() #5

Closed sonnyp closed 8 years ago

sonnyp commented 8 years ago

My guess would be there is a good reason for it missing from the proposal but just in case...

chicoxyzzy commented 8 years ago

NaN is a primitive. Number.isNaN() is in the spec

jasnell commented 8 years ago

isNaN() already works consistently across multiple contexts in Node.js which is the primary use case for these methods. Given that it works consistently already, I saw little reason for a NaN.isNaN()

sonnyp commented 8 years ago

I saw little reason for a NaN.isNaN()

Consistency? Not sure it's good enough though.

@chicoxyzzy primitives have properties. NaN.toString()

EDIT: I see your point Number.isNaN() probably makes more sense.

chicoxyzzy commented 8 years ago

@sonnyp primitives can't have any methods. In your example primitive value NaN is implicitly converted to Number object which has toString() method in it's prototype.

sonnyp commented 8 years ago

@chicoxyzzy okay, thanks