Skip to main content
Version: 3.27.2

Map()

The Map() constructor creates Map objects.

Syntax

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
    • : 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 new Map.