JSFiddle - React, Tailwind, and code Playground

by johnsonjo4531

JavaScript

class MultiMap extends Map {
	set (key, val) {
    var arr = (this.get(key)||[]);
    arr.push(val)
  	super.set(key, arr);
  }
}
var mmap = new MultiMap([[1,2], [1,3]]);
console.log(mmap);