I am calling two API’s and I’m getting two responses with Array values I want to merge those two arrays based on the key-value(name) matches. can anyone help with this
response one
const items = [
{
date: "2016-01-11",
data: [
{ name: "car", estimate: 1.94 },
{ name: "scooty", estimate: 0.73 },
{ name: "phone", estimate: 0.59 },
{ name: "laptop ", estimate: 0.59 }
]
}
];
response 2
const value = [
{ name: "car", actual: 1.94 },
{ name: "scooty", actual: 0.73 },
{ name: "phone", actual: 0.19 },
{ name: "laptop ", actual: 1.79 }
];
I want to do like this can any help on this, please
const mergedArrays = [
{
date: "2016-01-11",
data: [
{ name: "car", estimate: 1.94, actual: 1.94 },
{ name: "scooty", estimate: 0.73, actual: 0.73},
{ name: "phone", estimate: 0.93, actual: 0.19 },
{ name: "laptop ", estimate: 1.03, actual: 1.79 }
]
}
];