const array = [{
id: 1,
name: 'Bob',
education: [{
degree: 'bachelors',
Major: 'computers'
}, {
degree: 'masters',
Major: 'computers'
}]
},
{
id: 2,
name: 'Alice',
education: [{
degree: 'bachelors',
Major: 'electronics'
}, {
degree: 'masters',
Major: 'electronics'
}]
}
];
const resultArray = [{
id: 1,
name: 'Bob',
education: [{
degree: 'bachelors',
Major: 'computers',
id: 1
}, {
degree: 'masters',
Major: 'computers',
id: 1
}]
},
{
id: 2,
name: 'Alice',
education: [{
degree: 'bachelors',
Major: 'electronics',
id: 2
}, {
degree: 'masters',
Major: 'electronics',
id: 2
}]
}
];
I need assistance in adding the id
with its corresponding value from the array to each object in the education
array. Any suggestions on how I can achieve this?
Your help would be greatly appreciated.