I have 2 arrays:
const arrayOne = [
{ id: 1, name: "one" },
{ id: 2, name: "two" },
{ id: 3, name: "three" },
];
const arrayTwo = [
{ id: 2, name: "two" },
{ id: 3, name: "three" },
];
And I want the expected result in a new array:
const result = [
{ id: 1, name: "one" }
];
Im trying to use a method like filter, but I keep getting the same result (arrayOne)
const result = arrayOne.filter((element) => !arrayTwo.includes(element));
What is the best way to make it ?