-
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 markdown-lint-rule-zh-cn-1
- Loading branch information
Showing
430 changed files
with
7,312 additions
and
2,999 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
...dler/web-based_protocol_handlers/index.md → ...avigator/registerprotocolhandler/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
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
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
56 changes: 56 additions & 0 deletions
56
files/es/web/javascript/reference/global_objects/map/clear/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.clear() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/clear | ||
l10n: | ||
sourceCommit: 27180875516cc311342e74b596bfb589b7211e0c | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`clear()`** de las instancias {{jsxref("Map")}} remueve todos los elementos de este _map_. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-clear.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
clear() | ||
``` | ||
|
||
### Parámetros | ||
|
||
Ningúno. | ||
|
||
### Valor devuelto | ||
|
||
Ningúno ({{jsxref("undefined")}}). | ||
|
||
## Ejemplos | ||
|
||
### Usando clear() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("bar", "baz"); | ||
myMap.set(1, "foo"); | ||
|
||
console.log(myMap.size); // 2 | ||
console.log(myMap.has("bar")); // true | ||
|
||
myMap.clear(); | ||
|
||
console.log(myMap.size); // 0 | ||
console.log(myMap.has("bar")); // false | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} |
51 changes: 51 additions & 0 deletions
51
files/es/web/javascript/reference/global_objects/map/delete/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,51 @@ | ||
--- | ||
title: Map.prototype.delete() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/delete | ||
l10n: | ||
sourceCommit: 88d71e500938fa8ca969fe4fe3c80a5abe23d767 | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`delete()`** de las instancias {{jsxref("Map")}} remueve el elemento especificado de este _map_ utilizando la llave del elemento que se quiere remover. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-delete.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
mapInstance.delete(key) | ||
``` | ||
|
||
### Parámetros | ||
|
||
- `key` | ||
- : La llave de el elemento que se va a remover del objeto `Map`. | ||
|
||
### Valor devuelto | ||
|
||
`true` si un elemento en el objeto `Map` existía y fué removido, o `false` si el elemento no existe. | ||
|
||
## Ejemplos | ||
|
||
### Usando delete() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("bar", "foo"); | ||
|
||
console.log(myMap.delete("bar")); // Regresa true. Removido exitosamente. | ||
console.log(myMap.has("bar")); // Regresa false. El elemento "bar" ya no esta presente. | ||
``` | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} |
56 changes: 56 additions & 0 deletions
56
files/es/web/javascript/reference/global_objects/map/entries/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.entries() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/entries | ||
l10n: | ||
sourceCommit: 27180875516cc311342e74b596bfb589b7211e0c | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`entries()`** de las instancias {{jsxref("Map")}} regresa un nuevo objeto _[iterador de mapa](/es/docs/Web/JavaScript/Reference/Global_Objects/Iterator)_ que contiene las tuplas `[llave, valor]` para cada elemento en este _map_ en orden de inserción. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-entries.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
entries() | ||
``` | ||
|
||
### Parámetros | ||
|
||
Ningúno. | ||
|
||
### Valor devuelto | ||
|
||
Un nuevo [objeto de tipo iterator iterable](/es/docs/Web/JavaScript/Reference/Global_Objects/Iterator). | ||
|
||
## Ejemplos | ||
|
||
### Usando entries() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("0", "foo"); | ||
myMap.set(1, "bar"); | ||
myMap.set({}, "baz"); | ||
|
||
const mapIter = myMap.entries(); | ||
|
||
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.prototype.keys()")}} | ||
- {{jsxref("Map.prototype.values()")}} |
68 changes: 68 additions & 0 deletions
68
files/es/web/javascript/reference/global_objects/map/get/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,68 @@ | ||
--- | ||
title: Map.prototype.get() | ||
slug: Web/JavaScript/Reference/Global_Objects/Map/get | ||
l10n: | ||
sourceCommit: 3cfd663738e9963157d90f359789d675a6662ec2 | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
El método **`get()`** de las instancias de {{jsxref("Map")}} regresa un elemento específico de este _map_. Si el valor que esta asociado a la llave pasada como parámetro es un objeto, entonces obtendras una referencia a dicho objeto y cualquier cambio hecho a ese objeto, lo modificará también dentro del objeto `Map`. | ||
|
||
{{EmbedInteractiveExample("pages/js/map-prototype-get.html")}} | ||
|
||
## Sintaxis | ||
|
||
```js-nolint | ||
get(key) | ||
``` | ||
|
||
### Parámetros | ||
|
||
- `key` | ||
- : La llave del elemento que se quiere obtener del objeto `Mqp`. | ||
|
||
### Valor devuelto | ||
|
||
El elemento asociado a la llave pasada como parámetro, o {{jsxref("undefined")}} si la llave no se encuentra en el objeto `Map`. | ||
|
||
## Ejemplos | ||
|
||
### Usando get() | ||
|
||
```js | ||
const myMap = new Map(); | ||
myMap.set("bar", "foo"); | ||
|
||
console.log(myMap.get("bar")); // Regresa "foo" | ||
console.log(myMap.get("baz")); // Regresa undefined | ||
``` | ||
|
||
### Usando get() para recuperar una referencia a un objeto | ||
|
||
```js | ||
const arr = []; | ||
const myMap = new Map(); | ||
myMap.set("bar", arr); | ||
|
||
myMap.get("bar").push("foo"); | ||
|
||
console.log(arr); // ["foo"] | ||
console.log(myMap.get("bar")); // ["foo"] | ||
``` | ||
|
||
Note que el _map_ mantiene una referencia al objeto original, esto significa que el objeto no puede ser reclamado por el recolector de basura, lo que puede llevar a errores de memoria inesperados. Si deseas que el objeto guardado en el _map_ tenga el mismo tiempo de vida que el objeto original, considera usar un {{jsxref("WeakMap")}}. | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{jsxref("Map")}} | ||
- {{jsxref("Map.prototype.set()")}} | ||
- {{jsxref("Map.prototype.has()")}} |
Oops, something went wrong.