JavaScript Tutorial

Hashmap Implementation

Data structure that implements an associative array.

class HashMap {
  constructor() {
    this.storage = {};
  }
  set(key, value) {
    this.storage[key] = value;
  }
  get(key) {
    return this.storage[key];
  }
}