Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
jetako
· 16y ago · 0 comments
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
Comments
[–]
alunny
16y ago
it's because of type conversion - null has the same value as 0 (as in `(+ null)`), so it is a number
[–]
jetako
OP
16y 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.