jskatas.org Continuously Learn JavaScript. Your Way.

Map: map.get()

Map.prototype.get returns the element from the map for a key.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Map.prototype.get returns the element from the map for a key

  • get(key) returns the value stored for this key
  • multiple calls still return the same value
  • requires exactly the value as passed to set()
  • leave out the key, and you get the value set for the key undefined (void 0)
  • returns undefined for an unknown key