In this exercise we are going to perform a difference on 2 sets of data. We will create a method on our <code>Set</code> data structure called <code>difference</code>. A difference of sets should compare two sets and return the items present in the first set that are absent in the second. This method should take another <code>Set</code> as an argument and return the <code>difference</code> of the two sets.
For example, if <code>setA = ['a','b','c']</code> and <code>setB = ['a','b','d','e']</code>, then the difference of setA and setB is: <code>setA.difference(setB) = ['c']</code>.
- text: Your <code>Set</code> class should have a <code>difference</code> method.
testString: 'assert(function(){var test = new Set(); return (typeof test.difference === ''function'')}, ''Your <code>Set</code> class should have a <code>difference</code> method.'');'
- text: The proper collection was returned
testString: 'assert(function(){var setA = new Set(); var setB = new Set(); setA.add(''a''); setA.add(''b''); setA.add(''c''); setB.add(''c''); setB.add(''d''); var differenceSetAB = setA.difference(setB); return (differenceSetAB.size() === 2) && (differenceSetAB.values() === [ ''a'', ''b'' ])}, ''The proper collection was returned'');'