Search code examples
javascripttype-coercion

What happend internally in the case of null and undefined comparision?


console.log(null == undefined); // prints true
console.log(null === undefined); // prints false

The second statement is clear to me, no type conversion takes place and therefore false is printed. But what happens in the first statement, what is converted to what? Can someone help me understand?


Solution

  • No "conversion" is going on. They just compare equal, similar to the distinct values +0 and -0.