Consider the following: We have two arrays, each with an object.
let users: [
{
"id": "some#"
"name": "some name",
"data": "somedata"
}
],
let products: [
{
"product": "some#"
"name": "abc",
},
]
Essentially compare both objects, if the second object has the same property as the first, keep the second prop and value if not add the prop/value from the first.
So the output is :
{
"id": "some#",
"name": "abc",
"data": "somedata"
}