I want to take an existing array and add it to the existing array of Objects. I want to add a new key with values from reasons. Please help.
Array:
const reasons = ['a', 'b', 'c'];
Array of objects that look like:
[
{
id: 1,
Data: 'yes',
active: true
},
{
id: 2,
Data: 'yes',
active: false
},
{
id: 3,
Data: 'data',
active: false
}
]
Result want:
[
{
id: 1,
Data: 'yes',
active: true,
reason: a
},
{
id: 2,
Data: 'yes',
active: false,
reason: b
},
{
id: 3,
Data: 'data',
active: false,
reason: c
}
]