← All Exercises
Object Merge Utility
basicjavascript
Background
Merging objects is essential for configuration management, default options, and state updates in applications.
Problem
Write a function that takes two objects and returns a new object containing all properties from both, with the second object taking priority on conflicting keys.
Input
Two plain JavaScript objects as arguments.
Output
A new merged object with properties from both inputs.
Sample tests
Sample 1
Input: {a:1, b:2}, {b:3, c:4}Expected: {a:1, b:3, c:4}Your solution
Learning objective
Learn the spread operator for shallow object merging and understand property override behavior.