I have two arrays:
const arr1 = ['abc', 'def', 'ghi', 'jkl'];
const arr2 = ['123', 'abc', 'jkl', '456', '789'];
What would be the cleanest way to return arr2
without the elements of arr1
?
I guess arr2.filter(x => arr1.indexOf(x) < 0)
would work, but is there a cleaner way?