You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/05-data-types/07-map-set/02-filter-anagrams/solution.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
To find all anagrams, let's split every word to letters and sort them. When letter-sorted, all anagrams are same.
1
+
Um alle Anagramme zu finden, lassen wir uns jede Zeichenkette in Buchstaben aufteilen und sortieren sie. Wenn sie buchstabensortiert sind, sind alle Anagramme gleich.
Letter-sorting is done by the chain of calls in the line`(*)`.
34
+
Das Buchstabensortieren wird durch die Aufrufkette in der Zeile`(*)` durchgeführt.
35
35
36
-
For convenience let's split it into multiple lines:
36
+
Zur besseren Übersicht teilen wir es in mehrere Zeilen auf:
37
37
38
38
```js
39
39
let sorted = word // PAN
@@ -43,21 +43,21 @@ let sorted = word // PAN
43
43
.join(''); // anp
44
44
```
45
45
46
-
Two different words`'PAN'`and`'nap'`receive the same letter-sorted form`'anp'`.
46
+
Zwei unterschiedliche Wörter`'PAN'`und`'nap'`erhalten dieselbe buchstabensortierte Form`'anp'`.
47
47
48
-
The next line put the word into the map:
48
+
Die nächste Zeile fügt das Wort in die Map ein:
49
49
50
50
```js
51
51
map.set(sorted, word);
52
52
```
53
53
54
-
If we ever meet a word the same letter-sorted form again, then it would overwrite the previous value with the same key in the map. So we'll always have at maximum one word per letter-form.
54
+
Wenn wir erneut auf ein Wort mit derselben buchstabensortierten Form stoßen, wird der vorherige Wert mit demselben Schlüssel in der Map überschrieben. Daher haben wir immer maximal ein Wort pro Buchstabenform.
55
55
56
-
At the end`Array.from(map.values())`takes an iterable over map values (we don't need keys in the result) and returns an array of them.
56
+
Am Ende erzeugt`Array.from(map.values())`ein iterierbares über die Werte der Map (wir benötigen die Schlüssel im Ergebnis nicht) und gibt ein Array davon zurück.
57
57
58
-
Here we could also use a plain object instead of the `Map`, because keys are strings.
58
+
Hier könnten wir anstelle der `Map` auch ein einfaches Objekt verwenden, da die Schlüssel Zeichenketten sind.
0 commit comments