Your product could be here, in front of thousands of JavaScript developers. Sponsor this spot →
JavaScript Quiz

Why is {} === {} false in JavaScript?

Do you know what will be the output of this code?

JavaScript
console.log({} === {});
Show answer and explanation

The answer is false.

Each {} creates a new object in memory. === checks whether both sides are the same object, not whether they look the same.

Take the full quiz Next question →

More Basics questions

  1. Why do object keys 1 and "1" overwrite each other?
  2. What happens when you use an object as an object key?
  3. Are JavaScript objects copied by reference?
  4. Does the spread operator make a deep copy?
  5. Is Object.freeze deep or shallow?

Related topics