I have below two array of object in javascript
data1 = [
{
id: 123,
option: "ABC",
value: "123"
},
{
id: 234,
option: "DFG",
value: "234"
}
];
data2 = [
{
id: 123,
option: "ABC",
value: "123"
}
];
When the id is match with 2nd array of object then i wanted to set the value(property) to 0 in first array of object for that particular id only. Like below once id 123 got match in both array then data1 array should look like this
data1 = [
{
id: 123,
option: "ABC",
value: "0"
},
{
id: 234,
option: "DFG",
value: "234"
}
];
How to achieve the above scenario ?