In javascript, Map is used to store key-value pairs. The key-value pairs can be of both primitive and non-primitive types.
WeakMap is similar to Map with key differences:
The keys and values in weakmap should always be an object.
If there are no references to the object, the object will be garbage collected.