236

The type of NaN looks like a paradox

Comments
  • 13
    JavaScript is the only paradox!!
  • 5
    Truthiness has been spoken
  • 1
    Wow... Wtf... This is so wrong in so many levels 😂😂
  • 14
    NaN is signaling that something should be a number but isn't. Therefore it has the type number as that's what it represents.
  • 1
    Not a Number but it is itself a number to compare that's something is not a number haha
  • 1
    One of my previous rants was about isNaN(null) and isNaN(undefined) not giving the same value which makes less sense than this because you could say that the type of NaN is a number because it is used to represent an expected number where an invalid value for a number was given. But I have no idea why typeof(null) would be true unless numbers were considered nullable types which doesn't really make sense as that's the purpose of NaN...
  • 1
    We all know that js is a horrible mess that still allows you to write beautiful code if avoiding all the possible landmines, so I've been thinking, why not make a subscript of js with all the wide-recognised bad parts cut out? What do you guys think about that? I'm hugely underskilled to pull that off myself though 😥
  • 1
  • 7
    It's NaNber!
  • 1
    @jallman112 yeah, that book is exactly why I know about the existence of such parts :P
  • 2
    I still don't understand why these things bother people so much.
    1. These are results of implicit conversions which should force people to understand how that language really does these things.
    2. Saying a language is bad because of this is weird, since every language has its quirks when doing implicit things and there is not really much anyone can do about it. People will just have to understand the language they are using a bit better :)
  • 0
    @arekxv well if there are whole books literally saying that many parts of it are horrible, then it's not strange to see people telling it's horrible given that most of them will not care enough to learn it and get to the good parts? And (no offence) saying "you just don't know this language" is no excuse, because if a language doesn't makes sense, then most probably it's badly designed.
  • 0
    @trnktms hahaha I think this only make sense for "Latin derived" languages speakers
  • 0
    Not a number is a number
Add Comment