loading...

re: Basic Javascript: Removing Duplicates from an Array VIEW POST

TOP OF THREAD FULL DISCUSSION
re: With a Set, you can just do function removeDuplicates(array) { return [...new Set(array)] } Enter fullscreen mode Exit fulls...
 

I get a TypeScript error for trying to expand the set.
This works though:

function removeDuplicates(array) {
  return Array.from(new Set(array));
}

Seems like the simplest solution.

Code of Conduct Report abuse