The morning train’s goods A and the afternoon’s B as real Sets: union, intersection, difference and isSubsetOf put a new Set on track 3, and Sri shows every…
The key idea
A Set has built-in set operations, and always makes a new Set
Try it in this playground
union against intersection Run both to the end on the same trains.
difference both ways Run A.difference(B), then swap A and B: a different result.
Twin boxes Two boxes { id: 1 } in intersection: Set(0), because their numbers differ.
Count the array way’s reads Run a.filter(x => b.includes(x)) and compare with the has questions.