Object Spread Quiz
Multiple Choice Medium
Question
What does `{ ...a, ...b }` do when both `a` and `b` have a property with the same key?
Hint
Later spreads overwrite earlier ones for the same key.
Explanation
Object spread merges properties left to right. If both a and b have the same key, the value from b (the later spread) overwrites the value from a. This makes { ...defaults, ...overrides } a common pattern for merging configuration with overrides.
Related Resources
Related Lessons
- JavaScript Objects
Learn about object spread.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.