Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript remove duplicate in two arrays

array1 = array1.filter(function(val) {
  return array2.indexOf(val) == -1;
});
// Or, with the availability of ES6:

array1 = array1.filter(val => !array2.includes(val));
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #javascript #remove #duplicate #arrays
ADD COMMENT
Topic
Name
2+2 =