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

JavaScript Objects Quiz

Objects are stored and compared by reference, and their keys are always strings or symbols. That explains most object surprises, from {} === {} being false to keys overwriting each other.

These questions cover references, shallow copies, key order and serialization.

Objects 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. Why is {} === {} false in JavaScript?
  4. Are JavaScript objects copied by reference?
  5. Does the spread operator make a deep copy?
  6. Is Object.freeze deep or shallow?
  7. In what order does Object.keys return keys?
  8. Why does JSON.stringify drop undefined and functions?
  9. What is the difference between in and hasOwnProperty?
  10. How does optional chaining short-circuit in JavaScript?
  11. What does the rest operator do in object destructuring?
  12. Why can a Map have both 1 and "1" as keys?

More topics