Y
Hacker News
new
|
ask
|
show
|
jobs
by
jetako
5970 days ago
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
1 comments
alunny
5970 days ago
it's because of type conversion - null has the same value as 0 (as in `(+ null)`), so it is a number
link
jetako
5970 days ago
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.
link