Using Object.assign for Merging Objects in Javascript


Merge multiple objects into a single object.

Source Code

let obj1 = { a: 1 };
let obj2 = { b: 2 };
let merged = Object.assign({}, obj1, obj2);
console.log(merged);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments