Skip to content

Commit

Permalink
[es] Web/JavaScript/Reference/Global_Objects/Map/Map (#23176)
Browse files Browse the repository at this point in the history
* [es] translate map constructor
  • Loading branch information
seeker8 authored Aug 21, 2024
1 parent d1283e2 commit 908e7f2
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions files/es/web/javascript/reference/global_objects/map/map/index.md
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,
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")}}

0 comments on commit 908e7f2

Please sign in to comment.