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
Letter-sorting is done by the chain of calls in the line`(*)`.
34
+
A ordenação por letras é feita pela cadeia de chamadas na linha`(*)`.
35
35
36
-
For convenience let's split it into multiple lines:
36
+
Para maior clareza, vamos dividi-la em várias linhas:
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
+
Duas palavras diferentes,`'PAN'`e`'nap'`, recebem a mesma forma ordenada por letras,`'anp'`.
47
47
48
-
The next line put the word into the map:
48
+
A próxima linha coloca a palavra no mapa:
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
+
Se encontrarmos novamente uma palavra com a mesma forma ordenada por letras, ela irá sobrescrever o valor anterior com a mesma chave no mapa. Portanto, sempre teremos no máximo uma palavra por forma de letras.
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
+
No final, `Array.from(map.values())`cria um iterável sobre os valores do mapa (não precisamos das chaves no resultado) e retorna um array com eles.
57
57
58
-
Here we could also use a plain object instead of the `Map`, because keys are strings.
58
+
Aqui também poderíamos usar um objeto simples em vez do `Map`, porque as chaves são strings.
0 commit comments