The new spread syntax can be used to elegantly merge several objects in the following way:
const person = { name: 'David Walsh', gender: 'Male' };
const tools = { computer: 'Mac', editor: 'Atom' };
const summary = {...person, ...tools};
Is there a way to use this in a dynamical scenario, where the number and names of the objects to be merged are not known beforehand?
If
var objects_to_be_merged = get_objects();
generated an iterable list of objects during runtime, how can I use the spread operator iteratively to create a summary object like in the example above?