Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

Map() constructor

BaselineWidely available

TheMap() constructor createsMap objects.

Syntax

js
new Map()new Map(iterable)

Note:Map() can only be constructed withnew. Attempting to call it withoutnew throws aTypeError.

Parameters

iterableOptional

AnArray or otheriterable objectwhose elements are key-value pairs. (For example, arrays with two elements,such as[[ 1, 'one' ],[ 2, 'two' ]].) Each key-value pair is added to thenewMap.

Examples

Creating a new Map

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

Specifications

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

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp