Skip to content

Commit f72660f

Browse files
committed
translated until 299
1 parent 4756ed2 commit f72660f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,30 +273,30 @@ for (let user of set) {
273273
274274
Alternativa la `Set` ar putea fi o matrice de utilizatori, iar codul să verifice dacă există dubluri la fiecare inserare folosind [arr.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find). Dar performanța ar fi mult mai slabă, deoarece această metodă parcurge întreaga matrice verificând fiecare element. `Set` este mult mai bine optimizat la nivel intern pentru verificarea unicității.
275275
276-
## Iteration over Set
276+
## Iterare peste Set
277277
278-
We can loop over a set either with `for..of` or using `forEach`:
278+
Putem face o buclă peste un set fie cu `for..of` ori folosind `forEach`:
279279
280280
```js run
281281
let set = new Set(["oranges", "apples", "bananas"]);
282282
283283
for (let value of set) alert(value);
284284
285-
// the same with forEach:
285+
// același lucru cu forEach:
286286
set.forEach((value, valueAgain, set) => {
287287
alert(value);
288288
});
289289
```
290290
291-
Note the funny thing. The callback function passed in `forEach` has 3 arguments: a `value`, then *the same value* `valueAgain`, and then the target object. Indeed, the same value appears in the arguments twice.
291+
Observați lucrul ciudat. Funcția callback transmisă în `forEach` are 3 argumente: un `value`, apoi *aceeași valoare* `valueAgain`, și apoi obiectul țintă. Într-adevăr, aceeași value apare de două ori în argumente.
292292
293-
That's for compatibility with `Map` where the callback passed `forEach` has three arguments. Looks a bit strange, for sure. But this may help to replace `Map` with `Set` in certain cases with ease, and vice versa.
293+
Acest lucru este pentru compatibilitate cu `Map` unde funcția callback transmisă către `forEach` are trei argumente. Arată un pic ciudat, cu siguranță. Dar acest lucru poate ajuta la înlocuirea cu ușurință a `Map` cu `Set` în anumite cazuri, și vice versa.
294294
295-
The same methods `Map` has for iterators are also supported:
295+
Aceleași metode pe care `Map` le are pentru iteratori sunt de asemenea suportate:
296296
297-
- [`set.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/keys) -- returns an iterable object for values,
298-
- [`set.values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/values) -- same as `set.keys()`, for compatibility with `Map`,
299-
- [`set.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries) -- returns an iterable object for entries `[value, value]`, exists for compatibility with `Map`.
297+
- [`set.keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/keys) -- returnează un obiect iterabil pentru valori,
298+
- [`set.values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/values) -- la fel ca `set.keys()`, pentru compatibilitate cu `Map`,
299+
- [`set.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries) -- returnează un obiect iterabil pentru intrările `[value, value]`, există pentru compatibilitate cu `Map`.
300300
301301
## Summary
302302

0 commit comments

Comments
 (0)