I need to get the ID’s from arr1 that match names in arr2 and replace/add these name ID pairs into arr3.
arr1: {
[
id: [1234, 12345],
name: ‘one’,
},
{
id: [1270, 67812],
name: ‘two’,
},
{
id: [4970, 5170],
name: ’three’,
},
{
id: [02413, 02613],
name: ‘four’,
},
{
id: [8970],
name: ‘five’,
},
{
id: [7170, 6570, 6370],
name: ‘six’,
},
{
id: [8170, 22012, 4578, 33613],
name: ‘seven’,
},
{
id: [21812, 6170, 20412, 42812, 22012, 8170],
name: ‘eight’,
}]
arr2: [{
name: ‘one’,
}, {
name: ‘two’,
}, ]`
This would be result that needs to get pushed into a third array replacing the name elements with both names and ids.
arr3: [{
id: [1234, 12345],
name: ‘one’,
}, {
id: [1270, 67812],
name: ‘two’,
}