I have two arrays containing objects
const obj = {
teamRows: [
{name: 'Alice', admin_id: 1},
{name: 'Bob', admin_id: 2},
{name: 'Charlie', admin_id: 3},
],
roleRows: [
{title: 'Manager', role_id: 1},
{title: 'Supervisor', role_id: 2},
{title: 'Coordinator', role_id: 3},
]
};
I am looking to combine the objects from both arrays like this. Each object in teamRows corresponds to an object in roleRows
const newArr = [
{name: 'Alice', admin_id: 1, title: 'Manager', role_id: 1},
{name: 'Bob', admin_id: 2, title: 'Supervisor', role_id: 2},
{name: 'Charlie', admin_id: 3, title: 'Coordinator', role_id: 3},
]