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 accepts any number of source objects. Properties are applied left-to-right, so later sources overwrite earlier ones.
Challenge: Implement mergeAll(target, ...sources) that merges all sources into target.
mergeAll({}, { a: 1 }, { b: 2 }, { c: 3 }) // β { a: 1, b: 2, c: 3 }