Imagine having an array structure as shown below:
const student = [
{ firstName: 'Partho', Lastname: 'Das' },
{ firstName: 'Bapon', Lastname: 'Sarkar' }
];
const profile = [
{ education: 'SWE', profession: 'SWE' },
{ education: 'LAW', profession: 'Law' }
];
The objective is to combine these two objects, resulting in:
const student1 = [
{
firstName: 'Partho',
Lastname: 'Das',
profile: [{
education: 'SWE',
profession: 'SWE'
}]
}
];
const student2 = [
{
firstName: 'Bapon',
Lastname: 'Sarkar',
profile: [{
education: 'LAW',
profession: 'Law'
}]
}
];
Even though I'm new to JavaScript, I've attempted various approaches without success. Any guidance on resolving this using Javascript would be greatly appreciated.
Many thanks in advance!🙂