The Javascript Map get()
method returns a specified value by key from a Map object.
myMap.get(key)
It returns undefined
if the key can't be found in the Map object.
let myMap = new Map(); myMap.set('bar', 'foo'); console.log(myMap);//from w ww .j a va 2 s . co m let a = myMap.get('bar'); console.log(a);// Returns "foo" myMap.get('aKey'); console.log(a);// Returns undefined