Answer the question
In order to leave comments, you need to log in
js type conversion. Why 0 == null // false?
It would seem that
'==' starts casting to a number, i.e.
0 == null
Number(0) == Number(null)
0 === 0
true
In fact
0 == null //false
Why is that? How does it go through the steps?
Answer the question
In order to leave comments, you need to log in
"Null and undefined are equal == to each other and are not equal to anything else. This hard and fast rule is literally written into the language specification." I. Kantor
Because those are the specifications of the language. Here is the full table: https://dorey.github.io/JavaScript-Equality-Table/
And don't duplicate questions, please - read the language specifications, everything is there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question