Callable Map

A callable map is a type of callable class. In this case it's a Map() class that can be called as a function. It can be created in the following ways.
Copy
Once created you can use it as a function. The callable map will return the value of the key passed as an argument. If the key does not exist in the map, it will return undefined.
Copy

size

Returns the number of key/value pairs in the map. This is the same as the length property for arrays.
Copy

clear()

Clears the map. This will remove all the keys and values from the map.
Copy

delete()

Deletes the key/value pair from the map. If the key does not exist in the map, it will do nothing.
Copy

entries()

Returns an iterator object that contains the key/value pairs for each element in the map.
Copy

forEach()

Calls a function for each key/value pair in the map. The function is called with the value, key and the map itself as arguments.
Copy

get()

Returns the value associated with the key. If the key does not exist in the map, it will return undefined.
Copy

has()

Returns true if the key exists in the map, otherwise it will return false.
Copy

keys()

Returns an iterator object that contains the keys for each element in the map.
Copy

set()

Returns an iterator object that contains the keys for each element in the map.
Copy

values()

Returns an iterator object that contains the values for each element in the map.
Copy