object.assign()

PHOTO EMBED

Thu Aug 27 2020 20:14:09 GMT+0000 (Coordinated Universal Time)

Saved by @vrzi #javascript

const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 };

const returnedTarget = Object.assign(target, source);

console.log(target);
// expected output: Object { a: 1, b: 4, c: 5 }

console.log(returnedTarget);
// expected output: Object { a: 1, b: 4, c: 5 }
content_copyCOPY