I have the following array of friends:
friends = [
{id: 1, name: "uSUARIO2", username: "usuario1"},
{id: 2, name: "uSUARIO2", username: "usuario1"},
{id: 3, name: "uSUARIO3", username: "usuario1"},
{id: 4, name: "uSUARIO4", username: "usuario1"}
];
And this array of followings
followings = [
{id: 1, name: "uSUARIO1", username: "usuario1"},
{id: 2, name: "uSUARIO2", username: "usuario1"},
];
I need to delete the elements from the array of friends that are equal to the following array, I have made several attempts but without success yet. For now I have:
filterFriendsFollowing() {
let amigos_filtrados = this.friends.filter(
(friend) => {
for (let following of this.followings) {
return following['id'] == friend['id'];
}
})
}
How can I perform the filter correctly?