Map()
The Map()
constructor creates Map objects.
Syntax
new Map()
new Map(iterable)
Note:
Map()
can only be constructed withnew
. Attempting to call it withoutnew
throws aTypeError
.
Parameters
iterable
optional- : An
Array
or other iterable object whose elements are key-value pairs. (For example, arrays with two elements, such as[[ 1, 'one' ],[ 2, 'two' ]]
.) Each key-value pair is added to the newMap
.
- : An