Update the return value of values method in create a set class challenge (#40450)

* fix #40443

* Fix the solution add method
pull/40168/head
Kai-Chin Huang 2020-12-16 09:15:33 +08:00 committed by GitHub
parent 7c19c82076
commit a1928ba272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}