I need to convert an array of objects into an object of objects properties from the array.
Here is an example of an array of objects
const array = [
{
book:5,
car: 6,
pc: 7
},
{
headphone: 9,
keyboard: 10
},
];
I need it to be converted to
const obj = {
book:5,
car: 6,
pc: 7,
headphone: 9,
keyboard: 10
};
I tried many ways but can't achieve the final result. Thanks in advance