clear()
:
void
Removes all key/value pairs from this map.
delete(key
:
Object)
:
boolean
Removes the entry for the given key.
forEach(callback
:
Function)
:
void
Runs the provided callback function once for each key/value pair present in this map.
forEach(callback
:
Function, thisObject
:
Object)
:
void
Runs the provided callback function once for each key/value pair present in this map.
get(key
:
Object)
:
Object
Returns the value associated with the given key.
has(key
:
Object)
:
boolean
Returns if this map has value associated with the given key.
clear
clear()
:
void
Removes all key/value pairs from this map.
delete
delete(key
:
Object)
:
boolean
Removes the entry for the given key.
Parameters:
key
-
The key of the key/value pair to be removed from the map.
Returns:
true
if the map contained an entry for the passed key that was removed. Else false
is returned.
entries
Returns an iterator containing all key/value pairs of this map.
The iterator produces a series of two-element arrays with the first element as the key and the second element as the value.
forEach
Runs the provided callback function once for each key/value pair present in this map.
Parameters:
callback
-
The function to call, which is invoked with three arguments: the value of the element, the key of the element, and the Map object being iterated.
forEach
Runs the provided callback function once for each key/value pair present in this map.
Parameters:
callback
-
The function to call, which is invoked with three arguments: the value of the element, the key of the element, and the Map object being iterated.
thisObject
-
The Object to use as 'this' when executing callback.
get
Returns the value associated with the given key.
Parameters:
key
-
The key to look for.
Returns:
The value associated with the given key if an entry with the key exists else undefined
is returned.
has
Returns if this map has value associated with the given key.
Parameters:
key
-
The key to look for.
Returns:
true
if an entry with the key exists else false
is returned.
keys
Returns an iterator containing all keys of this map.
set
Adds or updates a key/value pair to the map.
You can't use JavaScript bracket notation to access map entries. JavaScript bracket notation accesses only
properties for Map objects, not map entries.
Parameters:
key
-
The key object.
value
-
The value to be associated with the key.
Returns:
This map object.
values
Returns an iterator containing all values of this map.