Is null
evaluated to 0
and undefined
to NaN
on arithmetic expressions?
According to some testing it seems so:
> null + null
0
> 4 + null
4
> undefined + undefined
NaN
> 4 + undefined
NaN
Is it safe or correct to assume this? (a quote from a documentation would be A+).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…