DEV Community

Discussion on: How to remove duplicates element from array

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Another 'using object' one with reduce:

const array = ["a","b","c","d","a","c","e","f"];
console.log(Object.keys(array.reduce((a,v)=>({...a,[v]:1}),{})));
Enter fullscreen mode Exit fullscreen mode
Collapse
 
abu profile image
Abu Jaid

yeah great !