I have two arrays of objects:
var existingUsers1 = [];
existingUsers1.push({
"userName": "A",
"departmentId": "1"
});
existingUsers1.push({
"userName": "B",
"departmentId": "1"
});
existingUsers1.push({
"userName": "C",
"departmentId": "1"
});
existingUsers1.push({
"userName": "D",
"departmentId": "1"
});
var existingUsers2 = [];
existingUsers2.push({
"userName": "A",
"departmentId": "1"
});
existingUsers2.push({
"userName": "B",
"departmentId": "1"
});
I need to find the objects from existingUsers1 that are not present in existingUsers2. Is there any function in nodeJS that I can use to achieve this or any other way?