I have 2 tables that look like this:
const array = [
{ id: "1", count: 75 },
{ id: "4", count: 32 }
];
const arrayFull = [
{ id: "1", count: 0 },
{ id: "2", count: 0 },
{ id: "3", count: 0 },
{ id: "4", count: 0 }
];
I want to check if the id of the objects of the arrayFull equals with the id of the objects of array. If they are not equal, I want to add the other object items. So in my example, the result should be:
const array = [
{ id: "1", count: 75 },
{ id: "2", count: 0 },
{ id: "3", count: 0 },
{ id: "4", count: 32 }
];
How can I do this? I tried with indexOf() and forEach() and did not work. I am using "target": "es2015".