DEV Community

Discussion on: 3 ways to remove duplicates in an Array in Javascript

Collapse
 
jimjam88 profile image
James Morgan

Don't forget reduce!

chars.reduce((acc, char) => acc.includes(char) ? acc : [...acc, char], []);

Collapse
 
spock123 profile image
Lars Rye Jeppesen

This is my preferred way,. I don't like using Sets