The has() function of the map object accepts a key in string format and returns a boolean value of true if the specified key exists. Otherwise, the function returns false.

Map is a data structure in JavaScript that allows the storage of [key, value] pairs where any value can be used as either a key or value.

Syntax

mapObject.has(key)

The has() function takes a key in the​ string format. It returns a boolean value that indicates ​the presence of that key in the Map object.