diff --git a/curriculum/challenges/english/10-coding-interview-prep/data-structures/perform-a-union-on-two-sets.md b/curriculum/challenges/english/10-coding-interview-prep/data-structures/perform-a-union-on-two-sets.md index ba50cbd226..04ecfb767f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/data-structures/perform-a-union-on-two-sets.md +++ b/curriculum/challenges/english/10-coding-interview-prep/data-structures/perform-a-union-on-two-sets.md @@ -25,7 +25,7 @@ assert( ); ``` -The union of `["a", "b", "c"]` and `["c", "d"]` should return `["a", "b", "c", "d"]`. +The union of a Set containing values ["a", "b", "c"] and a Set containing values ["c", "d"] should return a new Set containing values ["a", "b", "c", "d"]. ```js assert( @@ -67,12 +67,12 @@ class Set { } // This method will return all the values in the set values() { - return Object.keys(this.dictionary); + return Object.values(this.dictionary); } // This method will add an element to the set add(element) { if (!this.has(element)) { - this.dictionary[element] = true; + this.dictionary[element] = element; this.length++; return true; } @@ -113,12 +113,12 @@ class Set { } values() { - return Object.keys(this.dictionary); + return Object.values(this.dictionary); } add(element) { if (!this.has(element)) { - this.dictionary[element] = true; + this.dictionary[element] = element; this.length++; return true; }