jskatas.org Continuously Learn JavaScript. Your Way.

Map: map.has()

Indicates whether an element with a key exists.

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.has() indicates whether an element with a key exists

  • finds nothing in an empty map
  • finds an element by it`s key
  • finds undefined as key too
  • does not coerce keys
  • after removal (using map.delete(<key>)) it doesnt find the element anymore
  • adding an item (using map.set(key, value)) later will make has() return true


A video (15min) documenting how this kata was created.