JavaScript: Map.prototype.get

By Xah Lee. Date: . Last updated: .

New in JS2015.

mapObj.get(key)
Return the value of the key key in map mapObj.

If key isn't found, return undefined.

const xx = new Map([[4, "n4"], [5, "n5"]]);

// get the value of a key
console.log(xx.get(5) === "n5");

console.log(xx.get(99) === undefined);
BUY ΣJS JavaScript in Depth