Update the return value of values method in create a set class challenge (#40450)
* fix #40443 * Fix the solution add method
This commit is contained in:
@ -165,7 +165,7 @@ class Set {
|
|||||||
|
|
||||||
// This method will return all the values in the set
|
// This method will return all the values in the set
|
||||||
values() {
|
values() {
|
||||||
return Object.keys(this.dictionary);
|
return Object.values(this.dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only change code below this line
|
// Only change code below this line
|
||||||
@ -188,12 +188,12 @@ class Set {
|
|||||||
}
|
}
|
||||||
|
|
||||||
values() {
|
values() {
|
||||||
return Object.keys(this.dictionary);
|
return Object.values(this.dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
add(element) {
|
add(element) {
|
||||||
if (!this.has(element)) {
|
if (!this.has(element)) {
|
||||||
this.dictionary[element] = true;
|
this.dictionary[element] = element;
|
||||||
this.length++;
|
this.length++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user