I need assistance with merging values from an array into a predefined nested object. Here is an example of the array with values,
['name=ABC XYZ', 'hobbies=[M,N,O,P]', 'profession=S', 'age=27']
The object that needs to be updated with these values looks like this,
const person = {
details_1: {
name: null,
hobbies: null,
profession: null
},
details_2: {
age: null
}
};
The desired output should resemble the following structure,
const updated_person = {
details_1: {
name: 'ABC XYZ',
hobbies: [M,N,O,P],
profession: 'S'
},
details_2: {
age: 27
}
};
Your help on this matter is greatly appreciated!