I'm attempting to include new attributes to the sub-object within object1. However, I am facing issues with it being overwritten.
const object1 = {
a: 1,
b: 2,
c: 3,
sub: {
e: 1,
f: 2
}
};
const object2 = Object.assign({
j: 4,
m: 5
}, object1.sub);
console.log(object2);