GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — Map() constructor - JavaScript | MDN

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.

  • See full compatibility
  • Learn more

The Map() constructor creates Map objects.

Syntax

js
new Map()
new Map(iterable)

Note: Map() can only be constructed with new. Attempting to call it without new throws a TypeError.

Parameters

iterable Optional

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: 0 and 1, which correspond to the key and value (for example, [[1, "one"],[2, "two"]]). If you don't specify this parameter, or its value is null or undefined, the new Map is empty.

Examples

Creating a new Map

js
const myMap = new Map([
  [1, "one"],
  [2, "two"],
  [3, "three"],
]);

Specifications

Specification
ECMAScript® 2027 Language Specification
# sec-map-constructor

Browser compatibility

See also

  • Polyfill for Map in core-js
  • es-shims polyfill of Map
  • Set
  • WeakMap
  • WeakSet

Help improve MDN

Learn how to contribute

This page was last modified on Oct 26, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.