Quiz Explanation
In JavaScript, when you use the loose equality operator (==
) to compare two objects (including arrays), it checks whether the references to the objects are the same, not their contents.
In this case, []
creates two separate empty arrays in memory. Even though they look identical, they are two distinct objects occupying different memory locations.
Since they are two different objects, the comparison [] == []
evaluates to false
.
So, the output of the given code will be:
false