Suppose I have a data structure like this:
const list = [
{"hello": "world"},
{"goodbye": "cruel world"}
]
and I want to join it into:
{"hello": "world",
"goodbye": "cruel world"}
I can do it semi-elegantly like so:
const union = l.reduce((acc, o) => {
Object.keys(o).forEach((k) => acc[k] = o[k]);
return acc;
}, {})
But is there a more elegant way, perhaps built into the JS standard library?