Skip to content

Commit e942b5c

Browse files
committed
translated until line 154
1 parent efd5c5a commit e942b5c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

1-js/05-data-types/07-map-set/article.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ map.set('1', 'str1')
102102
103103
## Iterare peste Map
104104
105-
For looping over a `map`, there are 3 methods:
105+
Pentru a parcurge un `map`, există 3 metode:
106106
107-
- [`map.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys) -- returns an iterable for keys,
108-
- [`map.values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values) -- returns an iterable for values,
109-
- [`map.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries) -- returns an iterable for entries `[key, value]`, it's used by default in `for..of`.
107+
- [`map.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys) -- returnează un iterabil pentru chei,
108+
- [`map.values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values) -- returnează un iterabil pentru valori,
109+
- [`map.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries) -- returnează un iterabil pentru intrările `[cheie, valoare]`, este utilizat în mod implicit în `for..of`.
110110
111-
For instance:
111+
De exemplu:
112112
113113
```js run
114114
let recipeMap = new Map([
@@ -117,41 +117,41 @@ let recipeMap = new Map([
117117
['onion', 50]
118118
]);
119119
120-
// iterate over keys (vegetables)
120+
// iterați peste chei (vegetables)
121121
for (let vegetable of recipeMap.keys()) {
122122
alert(vegetable); // cucumber, tomatoes, onion
123123
}
124124
125-
// iterate over values (amounts)
125+
// iterați peste valori (amounts)
126126
for (let amount of recipeMap.values()) {
127127
alert(amount); // 500, 350, 50
128128
}
129129
130-
// iterate over [key, value] entries
131-
for (let entry of recipeMap) { // the same as of recipeMap.entries()
132-
alert(entry); // cucumber,500 (and so on)
130+
// iterați peste intrările [cheie, valoare]
131+
for (let entry of recipeMap) { // același lucru ca și în recipeMap.entries()
132+
alert(entry); // cucumber,500 (și așa mai departe)
133133
}
134134
```
135135
136-
```smart header="The insertion order is used"
137-
The iteration goes in the same order as the values were inserted. `Map` preserves this order, unlike a regular `Object`.
136+
```smart header="Se folosește ordinea de inserție"
137+
Iterația se desfășoară în aceeași ordine în care au fost inserate valorile. `Map` păstrează această ordine, spre deosebire de un `Object` obișnuit.
138138
```
139139
140-
Besides that, `Map` has a built-in `forEach` method, similar to `Array`:
140+
Pe lângă asta, `Map` are o metodă încorporată `forEach`, similară cu `Array`:
141141
142142
```js
143-
// runs the function for each (key, value) pair
143+
// rulează funcția pentru fiecare pereche (cheie, valoare)
144144
recipeMap.forEach( (value, key, map) => {
145145
alert(`${key}: ${value}`); // cucumber: 500 etc
146146
});
147147
```
148148
149-
## Object.entries: Map from Object
149+
## Object.entries: Map din Obiect
150150
151-
When a `Map` is created, we can pass an array (or another iterable) with key/value pairs for initialization, like this:
151+
Când se creează un `Map`, putem transmite un array (sau un alt iterabil) cu perechi cheie/valoare pentru inițializare, astfel:
152152
153153
```js run
154-
// array of [key, value] pairs
154+
// array de perechi [cheie, valoare].
155155
let map = new Map([
156156
['1', 'str1'],
157157
[1, 'num1'],

0 commit comments

Comments
 (0)