Map() constructor
Baseline Widely available
This 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
Parameters
Examples
Creating a new Map
js
const myMap = new Map([
[1, "one"],
[2, "two"],
[3, "three"],
]);
Specifications
| Specification |
|---|
| ECMAScript Language Specification # sec-map-constructor |
Browser compatibility
| desktop | mobile | server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Map() constructor | |||||||||||||
new Map(iterable) | |||||||||||||
new Map(null) | |||||||||||||