Update the return value of values method in create a set class challenge (#40450)
* fix #40443 * Fix the solution add methodpull/40168/head
parent
7c19c82076
commit
a1928ba272
|
@ -165,7 +165,7 @@ class Set {
|
|||
|
||||
// This method will return all the values in the set
|
||||
values() {
|
||||
return Object.keys(this.dictionary);
|
||||
return Object.values(this.dictionary);
|
||||
}
|
||||
|
||||
// Only change code below this line
|
||||
|
@ -188,12 +188,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue