Answers for "typescript find non matching objects in two arrays"

0

typescript find non matching objects in two arrays

const first = ['cat', 'dog', 'mouse'];
const second = ['zebra', 'tiger', 'dog', 'mouse'];
const removeCommon = (first, second) => {
   const spreaded = [...first, ...second];
   return spreaded.filter(el => {
      return !(first.includes(el) && second.includes(el));
   })
};
console.log(removeCommon(first, second));
Posted by: Guest on March-30-2021

Code answers related to "typescript find non matching objects in two arrays"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language