Answers for "remove duplicate values in array javascript"

50

js delete 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
2

javascript to remove duplicates from an array

uniqueArray = a.filter(function(item, pos) {
    return a.indexOf(item) == pos; 
})
Posted by: Guest on October-22-2020
2

how to remove duplicates in array in javascript

const numbers = [1 , 21, 21, 34 ,12 ,34 ,12];
const removeRepeatNumbers = array => [... new Set(array)]
removeRepeatNumbers(numbers) // [ 1, 21, 34, 12 ]
Posted by: Guest on September-25-2020
0

javascript to remove duplicates from an array

uniqueArray = a.filter(function(item, pos) {
    return a.indexOf(item) == pos;
})
Posted by: Guest on October-22-2020

Code answers related to "remove duplicate values in array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language