Hash Tables & JavaScript Objects
What operation is being performed in this hash table method?
class HashTable {
_resize() {
const newSize = this.keyMap.length * 2;
const nextPrime = this._findNextPrime(newSize);
const oldMap = this.keyMap;
this.keyMap = new Array(nextPrime);
oldMap.forEach(bucket => {
if (bucket) {
bucket.forEach(([key, value]) => this.set(key, value));
}
});
}
}