Map.prototype.get returns the element from the map for a key.
Map.prototype.get returns the element from the map for a key
get(key) returns the value stored for this key
let map = new Map();
map.set('key', 'value');
const value = map.get;
assert.equal(value, 'value');multiple calls still return the same value
let map = new Map();
map.set('value', 'value');
var value = map.get(map.get(map.get()));
assert.equal(value, 'value');requires exactly the value as passed to set()
let map = new Map();
const obj = {};
map.set({}, 'object is key');
assert.equal(map.get(obj), 'object is key');leave out the key, and you get the value set for the key undefined (void 0)
let map = new Map();
map.set(void 0, 'yo');
const value = map.get(___);
assert.equal(value, 'yo');returns undefined for an unknown key
let map = new Map();
map.set(void 0, 1);
const value = map.get();
assert.equal(value, void 0);