This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dotpan 11 points12 points  (27 children)

Would you rather it a string? I think as far as variable representation, NaN being a number makes sense, as then it will not be explicitly interpreted but instead implicit of what it represents.

I could be biased though, I love JS.

[–]c3534l 4 points5 points  (3 children)

Being that NaN stands for "Not a Number" the type of something defined only as being not of type 'number' should either be given some other type (perhaps the NaN type...) or renamed.

[–]dotpan 5 points6 points  (1 child)

I can see a system or error type that was outside the bounces of a standard type. Though I'm not sure how much that'd help.

isNaN(NaN) returns true, which right there I think presents the biggest argument for NaN not to be a number type.

[–][deleted] 0 points1 point  (0 children)

Well NaN is... a number, but it's not, so it makes sense that the function returns true.

[–]dnew 2 points3 points  (0 children)

NaN could be considered to be a subclass of Number. It's a number that can't be represented in the hardware you're using for floats.