Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove duplicates in array js, array js

const removeDuplicates = (arr) => [...new Set(arr)];
const arr = [1, 2, 3, 4, 5, 3, 1, 2, 5];
const distinct = removeDuplicates(arr);
console.log(distinct); // [1, 2, 3, 4, 5]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #remove #duplicates #array #array #js
ADD COMMENT
Topic
Name
6+6 =