remove duplicate items form array code example
Example 1: javascript filter array remove duplicates
// Using the Set constructor and the spread syntax:
arrayWithOnlyUniques = [...new Set(arrayWithDuplicates)]
Example 2: remove duplicates from array javascript
[...new Set(array)]
Example 3: remove duplicates from array
let chars = ['A', 'B', 'A', 'C', 'B'];
let uniqueChars = [...new Set(chars)];
console.log(uniqueChars);
output:
[ 'A', 'B', 'C' ]