I understand that both empty string and null are falsy according to the ECMAScript. If both are falsy then why doesn't the following evaluate to true?
var emptyString = '';
if (emptyString == null) {
console.log('emptyString == null');
}
else {
console.log('emptyString does not == null'); // but why?
}
apples == orangeswould also evaluate false.'' == []is true, but''is a falsey value and[]is a truthy value. Alsonull == undefinedis true, so there is at least one other case wherenull"equals" another falsey value.0 == ''and you will see that it in fact evaluates to true.