------Edited---------------
I have 2 arrays of objects A, B
var a = [{id:1},{id:2},{id:3},{id:4},{id:5}];
var b = [{id:1},{id:2},{id:3}];
I want to delete object which are both in A and in B
//after the operation
a = [{id:1},{id:2},{id:3}];
I thought in order to do it, I need to get the index of them in A to use A.splice() but I just cannot wrap my head around how I can do it.
This is the code I use to get the objects itself from Difference between two array of objects in JavaScript
var onlyInA = A.filter(function(current){
return res.nodes.filter(function(current_b){
return current_b._id == current._id
}).length == 0