I have an object {key: ‘Mother’, value: ‘Mam’}.
I need to get an object like {‘Mother’: ‘Mam’}
>Solution :
Your question is pretty vague but you could do:
const obj1 = {key: 'Mother', value: 'Mam'}
const obj2 = {[obj1.key]: obj1.value}
// obj2: {Mother: 'Mam'}