This sample script is for adding object to object by javascript.
Script :
var obj = {
key1: "value1",
key2: "value2",
key3: "value3"
};
var obj1 = {
key4: "value4",
key5: "value5",
key6: "value6"
};
Object.assign(obj, obj1);
console.log(obj);
Result :
{ key1: 'value1',
key2: 'value2',
key3: 'value3',
key4: 'value4',
key5: 'value5',
key6: 'value6' }