Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[es] Web/JavaScript/Reference/Global_Objects/Map/Map #23176

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Map() constructor
slug: Web/JavaScript/Reference/Global_Objects/Map/Map
l10n:
sourceCommit: 70f09675ddcfc75a3bb66d2dce4cf82738948a37
---

{{JSRef}}

El constructor **`Map()`** crea objetos de tipo {{jsxref("Map")}}.

## Sintaxis

```js-nolint
new Map()
new Map(iterable)
```

> **Nota:** `Map()` sólo puede ser construido con la palabra clave [`new`](/es/docs/Web/JavaScript/Reference/Operators/new). Intentar llamaro sin la palabra clave `new` arroja un {{jsxref("TypeError")}}.

### Parametros

- `iterable` {{optional_inline}}
- : Un objeto {{jsxref("Array")}} u otro objeto
[iterable](/es/docs/Web/JavaScript/Reference/Iteration_protocols) cuyos elementos sean tuplas llave-valor. (Por ejemplo, arreglos con dos elementos,
seeker8 marked this conversation as resolved.
Show resolved Hide resolved
tales como `[[ 1, 'one' ],[ 2, 'two' ]]`.) Cada tupla llave-valor es agregada al nuevo objeto `Map`.

## Ejemplos

### Creando un nuevo objeto Map

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

## Especificaciones

{{Specifications}}

## Compatibilidad con navegadores

{{Compat}}

## Véase también

- [Polyfill para `Map` en `core-js`](https://github.com/zloirock/core-js#map)
- {{jsxref("Set")}}
- {{jsxref("WeakMap")}}
- {{jsxref("WeakSet")}}
Loading