I am stuck on this problem. I have two arrays (simplified here)
const array1 = [1,2,3]
const array2 = [1,2]
I want to create a new array comparing the similar values between them and removing them so the final array would be
const finalArray = [3]
I have tried this among many other combinations of mapping filtering, for loops, I don't remember what else I've tested hence only have this too post
var finalArray = array1.filter(function (e) {
return array2.indexOf(e) > -1;
});
The result of this is just
[1,2]
Hoping someone can point out a solution, I'm sure it's obvious, but I am scratching my head at this point