mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-02 10:13:00 +08:00
feat(chapter_hashing): Add js and ts codes for chapter hashing (#675)
* refactor(chapter_hashing): Remove unnecessary chaining operator * feat(chapter_hashing): Add js and ts codes for chapter 6 * refactor(chapter_hashing): Optimize the remove function logic * refactor(chapter_hashing): Remove unnecessary chaining operator * refactor(chapter_hashing): use const instead of let
This commit is contained in:
@@ -62,7 +62,7 @@ class ArrayHashMap {
|
||||
let arr = [];
|
||||
for (let i = 0; i < this.#buckets.length; i++) {
|
||||
if (this.#buckets[i]) {
|
||||
arr.push(this.#buckets[i]?.key);
|
||||
arr.push(this.#buckets[i].key);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
@@ -73,7 +73,7 @@ class ArrayHashMap {
|
||||
let arr = [];
|
||||
for (let i = 0; i < this.#buckets.length; i++) {
|
||||
if (this.#buckets[i]) {
|
||||
arr.push(this.#buckets[i]?.val);
|
||||
arr.push(this.#buckets[i].val);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
|
||||
Reference in New Issue
Block a user