I have an array of objects with key-value pair, how to convert it to an object by reducing it to a single object by removing keys. I tried with map filter reduce but couldn't get the desired result. please help
const object = Object.assign({}, ...obj); // not working
const result = {};
Object.keys(object).forEach((key, index) => {
result[`newObj${index + 1}`] = obj[key].map(item => ({[key]: item}));
}); // not working
Input
obj = [{key: name, value: jack},{key: age, value: 10},{key: country, value: india},{key: state, value: Delhi}];
Output
{name:jack, age:10, country:india, state: Delhi}