Map : Object
Maps allow associating keys and values similar to normal Objects except Maps allow any Object to be used as a key instead of just Strings and Symbols. Maps use get() and set() methods to access the values stored in the Map. A Map are often called a HashTable or a Dictionary in other languages.
Instance Methods
Removes key
and its corresponding value from this
. Returns true
if key
was in this
before deleting it.
Example:
RunResults:
Returns an iterator of the index and items in this
where the values
s of the iterator are of the form [key : Object, value : Object]
. The entries
function is also returned for this[Symbol.iterator]
so you can iterate over this
directly to get the entries. See also keys()
and values()
.
Example:
RunResults:
Calls callback
for each key/value pair in this
. The Map
passed to callback
is the this
of the call to forEach
.
Example:
RunResults:
Copyright © JavaScripture Contributors