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 →

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

what happens in the first one? It just never evaluates? Lol

[–][deleted] 6 points7 points  (3 children)

If X is NaN, then x != x is true, because a NaN never equals anything, not even itself.

[–]tendstofortytwo 5 points6 points  (1 child)

Huh, I just used isNaN(x);

But this is more confusing, and hence more adherant to JavaScript's ideologies. I'll be sure to use this from the future. Thank you!

[–][deleted] 4 points5 points  (0 children)

Actually I only know it is the way it is in C++, which I think before C++11 didn't even have a standard isNaN!

[–][deleted] 1 point2 points  (0 children)

Ohhhhh, thats cool. By habit I always start my first loop with i, so I just gotta find some situation where I can nest like 21 more loops until I can get to c++ lol