Answers for "remove from array if two elements are duplicate and ordered"

7

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));
Posted by: Guest on April-27-2020
0

remove duplicates in array

uniq = [...new Set(array)];

or 

uniqueArray = a.filter(function(item, pos) {
    return a.indexOf(item) == pos;
})
Posted by: Guest on April-16-2021

Code answers related to "remove from array if two elements are duplicate and ordered"

Code answers related to "Javascript"

Browse Popular Code Answers by Language