typescript find non matching objects in two arrays

Solutions on MaxInterview for typescript find non matching objects in two arrays by the best coders in the world

showing results for - "typescript find non matching objects in two arrays"
Valentino
08 Jan 2018
1const first = ['cat', 'dog', 'mouse'];
2const second = ['zebra', 'tiger', 'dog', 'mouse'];
3const removeCommon = (first, second) => {
4   const spreaded = [...first, ...second];
5   return spreaded.filter(el => {
6      return !(first.includes(el) && second.includes(el));
7   })
8};
9console.log(removeCommon(first, second));