Answers for "whats the best way to remove duplicates from an array"

11

removing duplicates in array javascript

let arr = [1,2,3,1,1,1,4,5]
    
let filtered = arr.filter((item,index) => arr.indexOf(item) === index)
    
 console.log(filtered) // [1,2,3,4,5]
Posted by: Guest on April-08-2021

Code answers related to "whats the best way to remove duplicates from an array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language