Object.assignbeginner// Merge source into target
const target = { a: 1 }
Object.assign(target, { b: 2 }) // β { a: 1, b: 2 }Use Object.assign() to copy properties from one or more source objects into a target object.
Object.assign(target, ...sources) copies enumerable own properties from source objects into the target and returns the modified target.
Challenge: Implement mergeObjects(target, source) that merges source into target using Object.assign.
mergeObjects({ a: 1 }, { b: 2 }) // β { a: 1, b: 2 }