Submitted by Jesper on March 15, 2013 - 00:12
What are numbers equal to when they don't have proper values?
null = 0undefined = NaN
How would you test if a number is NaN?
If your answer was "x == NaN", you'd be wrong. The IEEE floating point standard requires that NaN be unequal to itself. More info on the NaN wikipedia entry.
Using that quirk to your advantage, you can simply do:
x !== x // If x is NaN, then this will be true.
Weird non-equality related hint: ".valueOf" trumps ".toString" for string concatenation of objects.