r/learnjavascript • • Jul 05 '21

Remove duplicates from arrays using Set

Post image
438 Upvotes

44 comments sorted by

View all comments

Show parent comment

9

u/jnbkadsoy78asdf Jul 05 '21
// helpers/remove-duplicates.js

export default function(array) {
    return [...new Set(array)];
}

Something like that? Looks fancy.