I am struggling to find a way to combine an array of objects into one object. All the solutions I have come across so far yield an array as the result, but I need an object. Here is an example:
[
{
'1112225544': '1',
'3258458756': '9',
'3654125412': '5',
},
{
'2229993827': '0',
'9827719902': '1',
'0000000000': '2',
'1112225544': '3',
},
...
]
There can be many objects inside the array. I want to flatten them and get this as the output:
{
'3258458756': '9',
'3654125412': '5',
'2229993827': '0',
'9827719902': '1',
'0000000000': '2',
'1112225544': '3'
}
Notice that the duplicate keys get overridden by whatever values the last array has. The solutions I have seen thus far are of this variety and don't quite work for me.