javascript spread two objects into one code example
Example 1: merge properties of object typescript
const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 };
// Copies source to target object without changing
// target object instance
const returnedTarget = Object.assign(target, source);
Example 2: merge objects js
/* For the case in question, you would do: */
Object.assign(obj1, obj2);
/** There's no limit to the number of objects you can merge.
* All objects get merged into the first object.
* Only the object in the first argument is mutated and returned.
* Later properties overwrite earlier properties with the same name. */
const allRules = Object.assign({}, obj1, obj2, obj3, etc);