Loading problem…
Implement Object.myAssign — a polyfill that behaves like native Object.assign for common interview scenarios.
Object.assign(target, ...sources) copies enumerable own properties from each source to the target object and returns the target.
Object.myAssign(target, ...sources)TypeError if target is null or undefined.target to an object and mutate that object.null and undefined sources.'abc', true, 42) and copy any enumerable own props (e.g. string indices).const target = { a: 1 };
const source1 = { b: 2 };
const source2 = { a: 3, c: 4 };
Object.myAssign(target, source1, source2);
// { a: 3, b: 2, c: 4 }