I have a situation like this:
var first = [
{'id': 1},
{'id': 2},
{'id': 3},
{'id': 4}
];
var second = [
{'id': 2},
{'id': 4}
];
I would like to filter all elements from "first" where the id is inside "second". I am trying something like this:
var result = first.filter((x:any) => second.id.indexOf(x.id) < 0);
I tried with foreach, but it did not work. The result I would like to get is this:
var first = [
{'id': 2},
{'id': 4}
];