diff --git a/curriculum/challenges/english/08-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md b/curriculum/challenges/english/08-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md
index c2ff098f24..98e55cf99d 100644
--- a/curriculum/challenges/english/08-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md
+++ b/curriculum/challenges/english/08-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.english.md
@@ -7,8 +7,8 @@ forumTopicId: 301707
## Description
-In this exercise we are going to perform a subset test on 2 sets of data. We will create a method on our Set
data structure called subset
. This will compare the first set, against the second and if the first set is fully contained within the Second then it will return true.
-For example, if setA = ['a','b']
and setB = ['a','b','c','d']
, then the subset of setA and setB is: setA.subset(setB)
should be true
.
+In this exercise, we are going to perform a subset test on 2 sets of data. We will create a method on our Set
data structure called isSubsetOf
. This will compare the first set against the second, and if the first set is fully contained within the second, it will return true
.
+For example, if setA = ['a','b']
and setB = ['a','b','c','d']
, then setA
is a subset of setB
, so setA.isSubsetOf(setB)
should return true
.
## Instructions
@@ -21,18 +21,18 @@ For example, if setA = ['a','b']
and setB = ['a','b','c','d']
```yml
tests:
- - text: Your Set
class should have a subset
method.
- testString: assert((function(){var test = new Set(); return (typeof test.subset === 'function')})());
+ - text: Your Set
class should have a isSubsetOf
method.
+ testString: assert((function(){var test = new Set(); return (typeof test.isSubsetOf === 'function')})());
- text: The first Set() should be contained in the second Set
- testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setB.add('b'); setB.add('c'); setB.add('a'); setB.add('d'); var subsetSetAB = setA.subset(setB);return (subsetSetAB === true)})());
- - text: ['a', 'b'].subset(['a', 'b', 'c', 'd'])
should return true
- testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setB.add('a'); setB.add('b'); setB.add('c'); setB.add('d'); var subsetSetAB = setA.subset(setB); return (subsetSetAB === true)})());
- - text: ['a', 'b', 'c'].subset(['a', 'b'])
should return false
- testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setA.add('c'); setB.add('a'); setB.add('b'); var subsetSetAB = setA.subset(setB); return (subsetSetAB === false)})());
- - text: [].subset([])
should return true
- testString: assert((function(){var setA = new Set(); var setB = new Set(); var subsetSetAB = setA.subset(setB); return (subsetSetAB === true)})());
- - text: ['a', 'b'].subset(['c', 'd'])
should return false
- testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setB.add('c'); setB.add('d'); var subsetSetAB = setA.subset(setB); return (subsetSetAB === false)})());
+ testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setB.add('b'); setB.add('c'); setB.add('a'); setB.add('d'); var aIsSubsetOfB = setA.isSubsetOf(setB);return (aIsSubsetOfB === true)})());
+ - text: ['a', 'b'].isSubsetOf(['a', 'b', 'c', 'd'])
should return true
+ testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setB.add('a'); setB.add('b'); setB.add('c'); setB.add('d'); var aIsSubsetOfB = setA.isSubsetOf(setB); return (aIsSubsetOfB === true)})());
+ - text: ['a', 'b', 'c'].isSubsetOf(['a', 'b'])
should return false
+ testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setA.add('c'); setB.add('a'); setB.add('b'); var aIsSubsetOfB = setA.isSubsetOf(setB); return (aIsSubsetOfB === false)})());
+ - text: [].isSubsetOf([])
should return true
+ testString: assert((function(){var setA = new Set(); var setB = new Set(); var aIsSubsetOfB = setA.isSubsetOf(setB); return (aIsSubsetOfB === true)})());
+ - text: ['a', 'b'].isSubsetOf(['c', 'd'])
should return false
+ testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setB.add('c'); setB.add('d'); var aIsSubsetOfB = setA.isSubsetOf(setB); return (aIsSubsetOfB === false)})());
```
@@ -223,7 +223,7 @@ class Set {
return newSet;
}
- subset(set) {
+ isSubsetOf(set) {
for(const value of this.values()){
if(!set.dictionary[value]) return false;
}