Answers for "js array merge but remove duplicates"

95

js remove duplicates from array

const names = ['John', 'Paul', 'George', 'Ringo', 'John'];

let unique = [...new Set(names)];
console.log(unique); // 'John', 'Paul', 'George', 'Ringo'
Posted by: Guest on March-11-2020
0

compare two arrays and remove duplicates javascript

array1 = array1.filter(function(val) {
  return array2.indexOf(val) == -1;
});
Posted by: Guest on September-08-2021

Code answers related to "js array merge but remove duplicates"

Code answers related to "Javascript"

Browse Popular Code Answers by Language