News for hackers. Stuff that matters.
Re:WTFJS? by jetako on Friday February 12, 2010 @05:59PM (#1122063)
isNaN(null) == false; is the only wtf I can never remember to avoid, because I can't rationalize it no matter how hard I try.

Edit: I get it now. null coverts to 0

Re:WTFJS? by alunny on Friday February 12, 2010 @06:02PM (#1122067)
it's because of type conversion - null has the same value as 0 (as in `(+ null)`), so it is a number
Re:WTFJS? by jetako on Friday February 12, 2010 @06:14PM (#1122092)
Yea, what a weird mental block, not realizing null is equivalent to 0, even in math statements. I guess it's because null is not the same as 0 when converted to a String.