Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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]
 
PREVIOUS NEXT
Tagged: #removing #duplicates #array #javascript
ADD COMMENT
Topic
Name
1+1 =