remove duplicates function javascript code example
Example 1: javascript remove duplicates from array
unique = [...new Set(arr)]; // where arr contains duplicate elements
Example 2: javascript to remove duplicates from an array
uniqueArray = a.filter(function(item, pos) {
return a.indexOf(item) == pos;
})