Closed sonnyp closed 8 years ago
NaN
is a primitive. Number.isNaN()
is in the spec
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()
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.
@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.
@chicoxyzzy okay, thanks
My guess would be there is a good reason for it missing from the proposal but just in case...