I generally don't prefer using == but today i was just experimenting with the following code including == and the results are a bit confusing to me. Can someone please explain what is happening?
All these are falsy values:
'', 0, false, undefined, null
Suppose i did:
if (undefined == null) {
alert('a');
} else {
alert('b');
}
The statements below give true:
null == undefined
0 == ''
false == ''
0 == false
But why does the code below return false?
undefined == 0
undefined == ''
null == 0