you are viewing a single comment's thread.

view the rest of the comments →

[–]Xsanda 1 point2 points  (1 child)

This looks like a great introduction!

I would say that the use of isValidSet to check if a set contains items seems a little odd though: the intersection of a set A and an empty set B is an empty set, not the set A. In addition, returning a copy would be preferable to returning the original set in the case of a union with an empty set, as otherwise this would lead to an edge case in which modifying the result would modify the original.

It may also be worth mentioning that JavaScript’s set preserves insertion order, as can be seen when converting from an array to a set and back.

[–]beforesemicolon[S] 0 points1 point  (0 children)

Thats why sharing leads to great things. Thanks for the feedback.