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 returns the target object, which is the same reference that was passed as the first argument.
Challenge: Implement checkReturnIsTarget(target, source) that calls Object.assign(target, source) and returns whether the result is strictly equal (===) to target.
checkReturnIsTarget({ a: 1 }, { b: 2 }) // β true