Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
balte22917yI was talking about this with a colleague and comparison to NaN should always result to false.
edit: realised you weren't doing comparison at all. -
fdgram4867yIt's not stupid. NaN is part of the number type specified in IEEE 754. Otherwise it wouldn't be possible, in languages with types, to specify that something is invalid/not a number/infinity/etc without another variable or flag.
-
willol13897y@Wiciaki yup just as specified in the standard. And getting false is the only result that could make sense. This is just gratuitous and ignorant bashing.
-
@willol Oh yes. I hate this type of bashing. Too few people are willing to to ask "why", instead skipping that part and directly start to rant.
It's fine to rant if the reasons are rubbish but not if you're too lazy to do some research. ^^ -
Noob64607yJavaScript is like a theatrical show.
Everything presented to you is not what it seems.
Keep that in mind and you won't miss the required checks.
Encapsulation by clever use of closures.
Arrays are lists.
Polymorphism and type casting.
JavaScript is a brain teaser.
I really like JS, but sometimes it's just incredibly stupid.
NaN stands for Not-A-Number
typeof NaN
> 'number'
why are you doing this to me
rant
javascript
type
nan
handling