I'm looking for a smart way to merge array of objects when they have different keys. "Smart" here I mean, you can use for loop for example to push or concat objects to create the desired object, but here I'm looking for a shorter way (like using map or such) if possible.
The below is an example of the array of objects where each object have different key.
[
{
privacy: true
},
{
date: true
}
]
From the above, the desired result would be like this below.
{
privacy: true,
date: true
}
So what can I implement smartly (but not for loop or a redundant way) to do this? Thanks for your help.