Have you ever wondered why undefined == null gives true, while undefined === null gives false in Javascript?

JavaScript is a language full of surprises, and one of its quirks is the way it handles undefined and null values.

Table of contents

No heading

No headings in the article.

JavaScript is a language full of surprises JavaScript's comparison operators can be tricky to master.

The difference between == and \=== can be confusing.

Do you know why this behaviour happen in JS?

Both null and undefined are falsy values.

When the equality (==) operator is used it compares only the value and gives "true" as output.

But When the Strict equality (===) operator is used it compares both the value and typeof Operator and gives "false" as output.