Skip to content

Commit

Permalink
Merge branch 'main' into usage-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gahotx authored Aug 28, 2024
2 parents d68e62e + fd7143c commit e850fc4
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: Map.prototype.forEach()
slug: Web/JavaScript/Reference/Global_Objects/Map/forEach
l10n:
sourceCommit: 27180875516cc311342e74b596bfb589b7211e0c
---

{{JSRef}}

El método **`forEach()`** de las instancias de {{jsxref("Map")}} ejecuta la función provista, una vez por cada tupla llave/valor en este _map_, en orden de inserción.

{{EmbedInteractiveExample("pages/js/map-prototype-foreach.html")}}

## Sintaxis

```js-nolint
forEach(callbackFn)
forEach(callbackFn, thisArg)
```

### Parámetro

- `callbackFn`
- : Una función que se ejecuta por cada entrada en el _map_. La función es llamada con los siguientes argumentos:
- `value`
- : El valor de cada iteración.
- `key`
- : La llave de cada iteración.
- `map`
- : El _map_ que esta siendo iterado.
- `thisArg` {{optional_inline}}
- : Un valor que se usa como `this` cuando se ejecuta la función `callbackFn`.

### Valor devuelto

Ningúno ({{jsxref("undefined")}}).

## Descripción

El método `forEach` ejecuta la función `callback` provista, una vez por cada llave que actualmente existe en el _map_. No se invoca para llaves que fueron borradas. Sin embargo, la función es ejecutada para valores que se encuentran en el objeto, pero que su valor es `undefined`.

La función `callback` es invocada con **tres argumentos**:

- el `value` del elemento
- el `key` del elemento
- el **objeto `Map`** que se esta iterando

Si el parámetro `thisArg` se provee a la función `forEach`, este se pasará a la función `callback` cuando sea invocada, para usarse como el valor `this`. De lo contrario, el valor `undefined` será pasado para usarse como el valor `this`. El valor `this` que finalmente es visible para la función `callback`, es determinado de acuerdo a [las reglas para determinar el valor `this` visible para una función](/es/docs/Web/JavaScript/Reference/Operators/this).

Cada valor es visitado una vez, excepto en el caso en que el valor es borrado y agregado antes de que `forEach` haya terminado. La función `callback` no es invocada para valores que se borraron antes de ser visitados. Los valores agregados antes de que `forEach` termine, serán visitados.

## Ejemplos

### Imprimiendo el contenido de un objeto Map

El siguiente código, registra en la consola un mensaje por cada elemento en un objeto `Map`:

```js
function logMapElements(value, key, map) {
console.log(`map.get('${key}') = ${value}`);
}
new Map([
["foo", 3],
["bar", {}],
["baz", undefined],
]).forEach(logMapElements);
// Logs:
// "map.get('foo') = 3"
// "map.get('bar') = [object Object]"
// "map.get('baz') = undefined"
```

## Especificaciones

{{Specifications}}

## Compatibilidad con navegadores

{{Compat}}

## Véase también

- {{jsxref("Array.prototype.forEach()")}}
- {{jsxref("Set.prototype.forEach()")}}
41 changes: 41 additions & 0 deletions files/es/web/javascript/reference/global_objects/map/size/index.md
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")}}
7 changes: 6 additions & 1 deletion files/ko/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,14 @@
/ko/docs/Web/HTTP/Access_control_CORS /ko/docs/Web/HTTP/CORS
/ko/docs/Web/HTTP/Access_control_CORS/Errors /ko/docs/Web/HTTP/CORS/Errors
/ko/docs/Web/HTTP/Access_control_CORS/Errors/CORSDidNotSucceed /ko/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed
/ko/docs/Web/HTTP/Basics_of_HTTP/Data_URIs /ko/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
/ko/docs/Web/HTTP/Basics_of_HTTP/Choosing_between_www_and_non-www_URLs /ko/docs/Web/URI/Authority/Choosing_between_www_and_non-www_URLs
/ko/docs/Web/HTTP/Basics_of_HTTP/Data_URIs /ko/docs/Web/URI/Schemes/data
/ko/docs/Web/HTTP/Basics_of_HTTP/Data_URLs /ko/docs/Web/URI/Schemes/data
/ko/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web /ko/docs/orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
/ko/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types /ko/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
/ko/docs/Web/HTTP/Basics_of_HTTP/Resource_URLs /ko/docs/Web/URI/Schemes/resource
/ko/docs/Web/HTTP/Index /ko/docs/Web/HTTP
/ko/docs/Web/HTTP/Resources_and_URIs /ko/docs/conflicting/Web/HTTP/Basics_of_HTTP/MIME_types
/ko/docs/Web/HTTP/상태_코드 /ko/docs/Web/HTTP/Status
/ko/docs/Web/JavaScript/A_re-introduction_to_JavaScript /ko/docs/Web/JavaScript/Language_overview
/ko/docs/Web/JavaScript/About /ko/docs/Web/JavaScript
Expand Down
32 changes: 16 additions & 16 deletions files/ko/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -6821,14 +6821,6 @@
"modified": "2019-03-23T22:27:07.176Z",
"contributors": ["peacekimjapan", "gaucho1218", "frankradio", "teoli"]
},
"Web/HTTP/Basics_of_HTTP/Choosing_between_www_and_non-www_URLs": {
"modified": "2020-11-23T08:52:22.702Z",
"contributors": ["nesez", "devcken"]
},
"Web/HTTP/Basics_of_HTTP/Data_URLs": {
"modified": "2019-03-23T22:27:00.710Z",
"contributors": ["devcken"]
},
"Web/HTTP/Basics_of_HTTP/Evolution_of_HTTP": {
"modified": "2019-12-02T03:03:46.499Z",
"contributors": [
Expand All @@ -6839,10 +6831,6 @@
"devcken"
]
},
"Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web": {
"modified": "2019-09-22T04:32:42.283Z",
"contributors": ["devcken"]
},
"Web/HTTP/Basics_of_HTTP/MIME_types": {
"modified": "2019-03-23T22:27:10.370Z",
"contributors": ["Jo-Seungjun", "DublinCity", "kangsan_Chang", "devcken"]
Expand Down Expand Up @@ -7249,10 +7237,6 @@
"modified": "2020-11-16T03:23:48.575Z",
"contributors": ["galcyurio", "mingrammer", "devcken"]
},
"Web/HTTP/Resources_and_URIs": {
"modified": "2019-03-18T21:43:18.320Z",
"contributors": ["jkpark"]
},
"Web/HTTP/Resources_and_specifications": {
"modified": "2019-03-23T22:26:24.310Z",
"contributors": ["devcken"]
Expand Down Expand Up @@ -10291,6 +10275,14 @@
"modified": "2019-03-23T23:28:14.827Z",
"contributors": ["featherlikeg", "nacyot", "pjc0247", "tamnajio", "KyunH"]
},
"Web/URI/Authority/Choosing_between_www_and_non-www_URLs": {
"modified": "2020-11-23T08:52:22.702Z",
"contributors": ["nesez", "devcken"]
},
"Web/URI/Schemes/data": {
"modified": "2019-03-23T22:27:00.710Z",
"contributors": ["devcken"]
},
"Web/XML": {
"modified": "2019-08-24T00:48:34.627Z",
"contributors": ["oinochoe", "ExE-Boss"]
Expand Down Expand Up @@ -10791,6 +10783,10 @@
"modified": "2020-10-15T22:06:25.915Z",
"contributors": ["alattalatta", "SphinxKnight", "dolmoon"]
},
"conflicting/Web/HTTP/Basics_of_HTTP/MIME_types": {
"modified": "2019-03-18T21:43:18.320Z",
"contributors": ["jkpark"]
},
"conflicting/Web/JavaScript/Reference/Errors/Deprecated_octal": {
"modified": "2020-03-12T19:44:24.834Z",
"contributors": ["magnoliaa"]
Expand Down Expand Up @@ -10819,6 +10815,10 @@
"modified": "2019-03-23T22:50:49.180Z",
"contributors": ["Basix"]
},
"orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web": {
"modified": "2019-09-22T04:32:42.283Z",
"contributors": ["devcken"]
},
"orphaned/Web/JavaScript/Reference/Errors/Undefined_prop": {
"modified": "2020-03-12T19:44:33.728Z",
"contributors": ["magnoliaa"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Resources and URIs
slug: Web/HTTP/Resources_and_URIs
slug: conflicting/Web/HTTP/Basics_of_HTTP/MIME_types
original_slug: Web/HTTP/Resources_and_URIs
---

{{HTTPSidebar}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 웹의 리소스 식별하기
slug: Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
slug: orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
original_slug: Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
l10n:
sourceCommit: 592f6ec42e54981b6573b58ec0343c9aa8cbbda8
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: www와 비-www URL 중에서 선택하기
slug: Web/HTTP/Basics_of_HTTP/Choosing_between_www_and_non-www_URLs
slug: Web/URI/Authority/Choosing_between_www_and_non-www_URLs
original_slug: Web/HTTP/Basics_of_HTTP/Choosing_between_www_and_non-www_URLs
l10n:
sourceCommit: b17bbdb47dba248d0539fc56fd1aeb664db38c29
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 데이터 URI
slug: Web/HTTP/Basics_of_HTTP/Data_URLs
slug: Web/URI/Schemes/data
original_slug: Web/HTTP/Basics_of_HTTP/Data_URLs
l10n:
sourceCommit: 997a0ec66e1514b7269076195b2419db334e876e
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Resource URLs
slug: Web/HTTP/Basics_of_HTTP/Resource_URLs
slug: Web/URI/Schemes/resource
original_slug: Web/HTTP/Basics_of_HTTP/Resource_URLs
l10n:
sourceCommit: 592f6ec42e54981b6573b58ec0343c9aa8cbbda8
---
Expand Down
6 changes: 4 additions & 2 deletions files/ru/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,10 @@
/ru/docs/Web/HTML/Общие_атрибуты/style /ru/docs/Web/HTML/Global_attributes/style
/ru/docs/Web/HTML/Общие_атрибуты/tabindex /ru/docs/Web/HTML/Global_attributes/tabindex
/ru/docs/Web/HTML/Ссылки /ru/docs/Web/HTML/Reference
/ru/docs/Web/HTTP/Basics_of_HTTP/Data_URIs /ru/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
/ru/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web_RU /ru/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
/ru/docs/Web/HTTP/Basics_of_HTTP/Data_URIs /ru/docs/Web/URI/Schemes/data
/ru/docs/Web/HTTP/Basics_of_HTTP/Data_URLs /ru/docs/Web/URI/Schemes/data
/ru/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web /ru/docs/orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
/ru/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web_RU /ru/docs/orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
/ru/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Полный_список_типов_MIME /ru/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
/ru/docs/Web/HTTP/Feature_Policy /ru/docs/Web/HTTP/Permissions_Policy
/ru/docs/Web/HTTP/Response_codes /ru/docs/Web/HTTP/Status
Expand Down
16 changes: 8 additions & 8 deletions files/ru/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -10553,14 +10553,6 @@
"modified": "2020-07-14T17:05:38.093Z",
"contributors": ["vladimir.i.kuropatka", "enonotugh", "cissoid"]
},
"Web/HTTP/Basics_of_HTTP/Data_URLs": {
"modified": "2020-10-15T22:23:29.676Z",
"contributors": ["alex3d", "ismorozs"]
},
"Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web": {
"modified": "2020-01-09T21:04:16.499Z",
"contributors": ["rshmelev"]
},
"Web/HTTP/Basics_of_HTTP/MIME_types": {
"modified": "2019-10-21T06:21:06.123Z",
"contributors": [
Expand Down Expand Up @@ -15867,6 +15859,10 @@
"aleks_root"
]
},
"Web/URI/Schemes/data": {
"modified": "2020-10-15T22:23:29.676Z",
"contributors": ["alex3d", "ismorozs"]
},
"Web/XML": {
"modified": "2019-03-24T13:24:33.354Z"
},
Expand Down Expand Up @@ -15945,5 +15941,9 @@
"WebAssembly/Using_the_JavaScript_API": {
"modified": "2019-06-12T07:08:20.267Z",
"contributors": ["deadblackclover", "vkorniiko"]
},
"orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web": {
"modified": "2020-01-09T21:04:16.499Z",
"contributors": ["rshmelev"]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Идентификация ресурсов в Вебе
slug: Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
slug: orphaned/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
original_slug: Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web
---

{{HTTPSidebar}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Data URL
slug: Web/HTTP/Basics_of_HTTP/Data_URLs
slug: Web/URI/Schemes/data
---

{{HTTPSidebar}}
Expand Down

0 comments on commit e850fc4

Please sign in to comment.