We know that false, 0, “”/”, undefined, null and NaN are considered as false in JavaScript. If all of them are considered as false, then why do we get false for the following abstract comparison.

Copy to Clipboard

Why false is not equals to undefined or why 0 is not equals to undefined in JavaScript

When we perform Abstract Comparison (using ==) with undefined, according to ECMAScript language specifications, it will be equals to Only null and comparing undefined with any other value will result in false. So, only the following comparisons with undefined will be true and comparison with anything else will be false

Copy to Clipboard