i have this 2 array,
const firstArray = [
{
key: 'a',
value: 'a'
},
{
key: 'b',
value: 'b'
},
{
key: 'c',
value: 'c'
}
]
const secondArray = [
{
key: 'b',
value: 'd'
},
{
key: 'c',
value: 'e'
}
]
i want to merge these 2 array, and if a same key found on second array the second array value will replace first array value
the new array should look like this
const expectedArray = [
{
key: 'a',
value: 'a'
},
{
key: 'b',
value: 'd'
},
{
key: 'c',
value: 'e'
}
]