The following prints 'A' as expected, since the data type is different so the array is coaxed into a primitive form which is false
for empty arrays.
if ([] == false)
console.log('A');
else
console.log('B');
But then why the following code too prints 'A'?
if ([])
console.log('A');
else
console.log('B');