The problem is that arrays are objects. When you compare two objects, you compare their references. Per the MDN documentation:
Since two instances of arrays don’t necessarily have the same reference, the check fails. Just try this in the console:
>  == 
Two arrays seemingly with the same content (or lack thereof) are not equal. That’s because content is not checked, but reference. These two arrays are separate instances and refer to different places in memory, thus the check evaluates to false.
On the other hand, just checking the length, and if it is zero checks if the array is empty or not. The
length property signifies the amount of content in an array1 and is part of every array. Since it is part of every array and reflects the amount of data in the array, you can use it to check if the array is empty or not.