Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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));
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #typescript #find #matching #objects #arrays
ADD COMMENT
Topic
Name
8+1 =