DEV Community

Discussion on: React.js - Interview Question - duplicate hashtag remover.

Collapse
 
capscode profile image
capscode • Edited

If you just want to remove the duplicates, then Set will be the easier solution to this

[...new Set(str.split(' '))] //str is the string holding all the hash tags entered
Enter fullscreen mode Exit fullscreen mode

this is just the snippet and not the complete implementation

Collapse
 
rajeshroyal profile image
Rajesh Royal

The duplicates needs to be removed one by one not at once.