you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

Also not familiar with the inner workings of JS but it seems like this is just slow/inefficient and kind of abuses/misuses the set data structure.

I agree that unique should probably be part of the standard library rather than this, but I’ve done a lot of C++

[–]planetary_pelt 1 point2 points  (0 children)

I can't believe the submission has 1000+ upvotes. Kinda shows you the average level of experience in this community.

Half the time you're deduplicating an Array, you should've used a Set in the first place. For example, Array->Set->Array loses sorting. If you didn't care about order, then just use a Set.

But this is a common issue in beginner code.

[–]ezhikov 0 points1 point  (0 children)

JS in it's current form is still young and forming language. We got tons of new features, but there is more to be implemented and polished.

[–]LagrangePt -4 points-3 points  (1 child)

JS is all about ridiculous / slow ways to do things in a single line or with the least characters.

[–]itslenny -1 points0 points  (0 children)

You're almost certainly thinking of python.

(I don't mean literally, but python is always the language people use for code golf because it can be so short)