Category
Create a new DefaultMap
with a specified default value.
Time complexity: O(n)
Space complexity: O(n)
The default value to use for missing keys
Optional
entries: null | Iterable<readonly [unknown, unknown]>const map = new DefaultMap(0);
Create a new DefaultMap
with a specified function to generate default values.
Time complexity: O(n)
Space complexity: O(n)
const map = new DefaultMap(key => key.toUpperCase());
Readonly
[toPrivate
Readonly
defaultIf the default value is a function.
Private
Readonly
defaultReadonly
sizethe number of elements in the Map.
Static
Readonly
[species]true if an element in the Map existed and has been removed, or false if the element does not exist.
boolean indicating whether an element with the specified key exists or not.
A
Map
that has a default value for missing keys.Example
Example
Map