Answers for "merge two array and remove duplicate js"

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 multidimensional array javascript

var arr = [[7,3], [7,3], [3,8], [7,3], [7,3], [1,2]];

arr.map(JSON.stringify).reverse().filter((e, i, a) => a.indexOf(e, i+1) === -1).reverse().map(JSON.parse) // [[7,3], [3,8], [1,2]]
Posted by: Guest on April-07-2022

Code answers related to "merge two array and remove duplicate js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language