-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into map-foreach-es
- Loading branch information
Showing
190 changed files
with
2,340 additions
and
1,419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...identifying_resources_on_the_web/index.md → ...identifying_resources_on_the_web/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
files/es/web/javascript/reference/global_objects/map/has/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: Map.prototype.has() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/has | ||
l10n: | ||
sourceCommit: 3cfd663738e9963157d90f359789d675a6662ec2 | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`has()`** de las instancias {{jsxref("Map")}} regresa un booleano indicando si un elemento con la llave especificada existe o no en este _map_. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-has.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
has(key) | ||
``` | ||
|
||
### Parámetros | ||
|
||
- `key` | ||
- : La llave del elemento que se quiere comprobar si existe en el objeto `Map`. | ||
|
||
### Valor devuelto | ||
|
||
`true` si un elemento con la llave especificada existe en el objeto `Map`; de lo contrario regresa `false`. | ||
|
||
## Ejemplos | ||
|
||
### Usando has() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("bar", "foo"); | ||
|
||
console.log(myMap.has("bar")); // true | ||
console.log(myMap.has("baz")); // false | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} | ||
- {{jsxref("Map.prototype.set()")}} | ||
- {{jsxref("Map.prototype.get()")}} |
56 changes: 56 additions & 0 deletions
56
files/es/web/javascript/reference/global_objects/map/keys/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Map.prototype.keys() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/keys | ||
l10n: | ||
sourceCommit: 27180875516cc311342e74b596bfb589b7211e0c | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`keys()`** de las instancias {{jsxref("Map")}} regresa un nuevo objeto _[iterator de map](/es/docs/Web/JavaScript/Reference/Global_Objects/Iterator)_ que contiene las llaves para cada elemento en este _map_ en orden de inserción. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-keys.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
keys() | ||
``` | ||
|
||
### Parámetros | ||
|
||
Ningúno. | ||
|
||
### Valor devuelto | ||
|
||
Un nuevo [objeto iterator iterable](/es/docs/Web/JavaScript/Reference/Global_Objects/Iterator). | ||
|
||
## Ejemplos | ||
|
||
### Usando keys() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("0", "foo"); | ||
myMap.set(1, "bar"); | ||
myMap.set({}, "baz"); | ||
|
||
const mapIter = myMap.keys(); | ||
|
||
console.log(mapIter.next().value); // "0" | ||
console.log(mapIter.next().value); // 1 | ||
console.log(mapIter.next().value); // {} | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map.prototype.entries()")}} | ||
- {{jsxref("Map.prototype.values()")}} |
67 changes: 67 additions & 0 deletions
67
files/es/web/javascript/reference/global_objects/map/set/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: Map.prototype.set() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/set | ||
l10n: | ||
sourceCommit: 3cfd663738e9963157d90f359789d675a6662ec2 | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`set()`** de las instancias {{jsxref("Map")}} agrega o actualiza una entrada en este _map_ con la llave y valor especificados. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-set.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
set(key, value) | ||
``` | ||
|
||
### Parámetros | ||
|
||
- `key` | ||
- : La llave del elemento que se va a agregar al objeto `Map`. La llave puede ser cualquiera de los [tipos de dato de JavaScript](/es/docs/Web/JavaScript/Data_structures) (cualquier [valor primitivo](/es/docs/Web/JavaScript/Data_structures#valores_primitivos) o cualquier tipo de [objeto JavaScript](/es/docs/Web/JavaScript/Data_structures#objetos)). | ||
- `value` | ||
- : El valor de el elemento que se va a agregar al objeto `Map`. El valor puede ser cualquiera de los [tipos de dato de JavaScript](/es/docs/Web/JavaScript/Data_structures) (cualquier [valor primitivo](/es/docs/Web/JavaScript/Data_structures#valores_primitivos) o cualquier tipo de [objeto JavaScript](/es/docs/Web/JavaScript/Data_structures#objetos)). | ||
|
||
### Valor devuelto | ||
|
||
El objeto `Map`. | ||
|
||
## Ejemplos | ||
|
||
### Usando set() | ||
|
||
```js | ||
const myMap = new Map(); | ||
|
||
// Agrega nuevos elementos a el map | ||
myMap.set("bar", "foo"); | ||
myMap.set(1, "foobar"); | ||
|
||
// Actualiza un elemento en el map | ||
myMap.set("bar", "baz"); | ||
``` | ||
|
||
### Usando set() encadenandolo | ||
|
||
Ya que el método `set()` regresa el mismo objeto `Map`, puedes encadenar la llamada al método como se muestra acontinuación: | ||
|
||
```js | ||
// Agrega nuevos elementos al map, encadenando las llamadas. | ||
myMap.set("bar", "foo").set(1, "foobar").set(2, "baz"); | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} | ||
- {{jsxref("Map.prototype.get()")}} | ||
- {{jsxref("Map.prototype.has()")}} |
41 changes: 41 additions & 0 deletions
41
files/es/web/javascript/reference/global_objects/map/size/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: Map.prototype.size | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/size | ||
l10n: | ||
sourceCommit: 6a0f9553932823cd0c4dcf695d4b4813474964fb | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
La propiedad de acceso **`size`** de las instancias {{jsxref("Map")}} regresa el número de elementos de este _map_. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-size.html")}} | ||
|
||
## Descripción | ||
|
||
El valor de `size` es un entero que representa, el número de entradas que el objeto `Map` tiene. La función de acceso para `size` es `undefined`; no puedes modificar esta propiedad. | ||
|
||
## Ejemplos | ||
|
||
### Usando size | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("a", "alpha"); | ||
myMap.set("b", "beta"); | ||
myMap.set("g", "gamma"); | ||
|
||
console.log(myMap.size); // 3 | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con nvegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} |
89 changes: 89 additions & 0 deletions
89
files/es/web/javascript/reference/global_objects/map/symbol.iterator/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
title: Map.prototype[Symbol.iterator]() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/Symbol.iterator | ||
l10n: | ||
sourceCommit: 6fbdb78c1362fae31fbd545f4b2d9c51987a6bca | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`[Symbol.iterator]()`** de las instancias {{jsxref("Map")}} implementa el [protocolo de iteración](/es/docs/Web/JavaScript/Reference/Iteration_protocols) y permite a los objetos `Map` ser consumidos por la mayoría de sintaxis que esperan iterables, como lo es, la [sintaxis spread](/es/docs/Web/JavaScript/Reference/Operators/Spread_syntax) y el bucle {{jsxref("Statements/for...of", "for...of")}}. Este método regresa un [objeto iterator de map](/es/docs/Web/JavaScript/Reference/Global_Objects/Iterator) que produce tuplas llave-valor del _map_ en orden de inserción. | ||
|
||
El valor inicial de esta propiedad, es el mismo objeto de función que el valor inicial de la propiedad {{jsxref("Map.prototype.entries")}}. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-@@iterator.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
map[Symbol.iterator]() | ||
``` | ||
|
||
### Parámetros | ||
|
||
Ningúno. | ||
|
||
### Valor devuelto | ||
|
||
El mismo valor devuelto que {{jsxref("Map.prototype.entries()")}}: un nuevo [objeto iterator iterable](/es/docs/Web/JavaScript/Reference/Global_Objects/Iterator) que produce tuplas llave-valor del _map_. | ||
|
||
## Ejemplo | ||
|
||
### Iteración usando el bucle for...of | ||
|
||
Note que raramente necesitará llamar este método directamente. La existencia de el método `[Symbol.iterator]()` hace a los objetos `Map` [iterables](/es/docs/Web/JavaScript/Reference/Iteration_protocols#el_protocolo_iterable), y sintaxis de iteracion como lo és el bucle `for...of` automáticamente llama a este método para obtener el iterador que se usará para iterar sobre el objeto. | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("0", "foo"); | ||
myMap.set(1, "bar"); | ||
myMap.set({}, "baz"); | ||
|
||
for (const entry of myMap) { | ||
console.log(entry); | ||
} | ||
// ["0", "foo"] | ||
// [1, "bar"] | ||
// [{}, "baz"] | ||
|
||
for (const [key, value] of myMap) { | ||
console.log(`${key}: ${value}`); | ||
} | ||
// 0: foo | ||
// 1: bar | ||
// [Object]: baz | ||
``` | ||
|
||
### Manualmente moviendo el iterador | ||
|
||
Puedes llamar manualmente el método `next()` del objeto iterator para tener máximo control sobre el proceso de iteración. | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("0", "foo"); | ||
myMap.set(1, "bar"); | ||
myMap.set({}, "baz"); | ||
|
||
const mapIter = myMap[Symbol.iterator](); | ||
|
||
console.log(mapIter.next().value); // ["0", "foo"] | ||
console.log(mapIter.next().value); // [1, "bar"] | ||
console.log(mapIter.next().value); // [Object, "baz"] | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} | ||
- {{jsxref("Map.prototype.entries()")}} | ||
- {{jsxref("Map.prototype.keys()")}} | ||
- {{jsxref("Map.prototype.values()")}} | ||
- {{jsxref("Symbol.iterator")}} | ||
- [Protocolos de Iteración](/es/docs/Web/JavaScript/Reference/Iteration_protocols) |
3 changes: 2 additions & 1 deletion
3
...ing_between_www_and_non-www_urls/index.md → ...ing_between_www_and_non-www_urls/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.