I'm working with a map over an object containing an array of objects.
Object.values(props.roleRateOptions).map(el => {
el.push(shift.roleRate);
return el;
})
The resulting array of objects looks like this:
[ {id:1},{id:2},{label:3} ]
The issue arises when I use push(shift.roleRate)
, as it assigns a value of label
instead of id
. How can I change this to id
? Is there any workaround, such as assigning a new id value if changing the existing one is not possible? Thank you in advance!