What will the console.log(null == undefined) statement output?
a)
true
b)
false
c)
undefined
d)
NaN
Answer:
a)
true
Explanation:
In JavaScript, null
and undefined
are loosely equal (==
), meaning they are treated as the same value in non-strict comparison, so null == undefined
returns true
.
However, they are not strictly equal (===
), as their types are different.