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.
El constructor Map()
crea objetos de tipo Map
.
Sintaxis
Parametros
iterable
Opcional-
Un objeto
Array
u otro objeto iterable cuyos elementos sean tuplas llave-valor. (Por ejemplo, arreglos con dos elementos, tales como[[ 1, 'one' ],[ 2, 'two' ]]
.) Cada tupla llave-valor es agregada al nuevo objetoMap
.
Ejemplos
Creando un nuevo objeto Map
js
const myMap = new Map([
[1, "one"],
[2, "two"],
[3, "three"],
]);
Especificaciones
Specification |
---|
ECMAScript Language Specification # sec-map-constructor |
Compatibilidad con navegadores
BCD tables only load in the browser