i’m trying to merge two array of object based on key. two array of object like this,
let array1 = [
{
name: "Deepak",
age: 20
},
{
name: "John",
age: 30
}
]
let array2 = [
{
name: "Deepak",
favGame: "Cricket"
},
{
name: "John",
favGame: "Football"
},
{
name: "Kailash",
favGame: "Basketball"
}
]
I found difficulties to merge as expected format. I expecting format like this
let finalArray = [
{
name: "Deepak",
age: 20,
favGame: "Cricket"
},
{
name: "John",
age: 30,
favGame: "Football"
},
{
name: "Kailash",
favGame: "Basketball"
}
]