Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Remove Duplicates array values in javascript

const array  = [5,4,7,8,9,2,7,5];
array.filter((item,idx,arr) => arr.indexOf(item) === idx);
// or
const nonUnique = [...new Set(array)];
// Output: [5, 4, 7, 8, 9, 2]
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #Remove #Duplicates #array #values #javascript
ADD COMMENT
Topic
Name
2+1 =