Map
suggest changeSyntax
- new Map([iterable])
- map.set(key, value)
- map.get(key)
- map.size
- map.clear()
- map.delete(key)
- map.entries()
- map.keys()
- map.values()
- map.forEach(callback[, thisArg])
Parameters
Parameter | Details |
---|---|
iterable | Any iterable object (for example an array) containing [key, value] pairs. |
key | The key of an element. |
value | The value assigned to the key. |
callback | Callback function called with three parameters: value, key, and the map. |
thisArg | Value which will be used as this when executing callback. |
Remarks
In Maps NaN
is considered to be the same as NaN
, even though NaN !== NaN
. For example:
const map = new Map([[NaN, true]]);
console.log(map.get(NaN)); // true
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents