Dawson Smith
Dawson Smith

Reputation: 531

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?

Upvotes: 0

Views: 29

Answers (1)

Bergi
Bergi

Reputation: 664346

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

Upvotes: 1

Related Questions