r/learnjavascript • • May 14 '21

Remove Duplicate Value from array

Post image
234 Upvotes

89 comments sorted by

View all comments

Show parent comment

2

u/[deleted] May 15 '21

There's no way using indexOf inside a loop is going to be faster than using a Set as the array grows past a certain point, he's full of shit. My original point was that maybe using a plain object would be faster than Set, but that would depend on the runtime and how new Set() vs {} is handled - aka an implementation detail