Map() constructor
Baseline Widely availableThis feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
>The Map() constructor creates Map objects.
Syntax
jsnew Map()
new Map(iterable)
Note:
Map() can only be constructed with new. Attempting to call it without new throws a TypeError.
Parameters
iterableOptional-
If an iterable object (such as an array) is passed, all of its elements will be added to the new
Map. Each element must be an object with two properties:0and1, which correspond to the key and value (for example,[[1, "one"],[2, "two"]]). If you don't specify this parameter, or its value isnullorundefined, the newMapis empty.
Examples
>Creating a new Map
jsconst myMap = new Map([
[1, "one"],
[2, "two"],
[3, "three"],
]);
Specifications
| Specification |
|---|
| ECMAScript® 2027 Language Specification > # sec-map-constructor > |
Browser compatibility
See also
Help improve MDN
Was this page helpful to you? Yes No Learn how to contributeThis page was last modified on Oct 26, 2026 by MDN contributors.
View this page on GitHub • Report a problem with this content