Arrays by diogoosz · Pull Request #479 · javascript-tutorial/pt.javascript.info
Repository navigation
Arrays - #479
Merged
gabifs merged 2 commits into javascript-tutorial:master from diogoosz:translate-arrays Nov 21, 2026
Merged
Arrays #479 gabifs merged 2 commits into javascript-tutorial:master from diogoosz:translate-arrays
Conversation
diogoosz commented Nov 8, 2026
Copy link Copy Markdown
Contributor
Tradução do artigo "Arrays" para o português, incluindo os exercícios e as imagens array-pop.svg e array-shift.svg.
Conforme comentado na #1 .
Translate "Arrays" article to Portuguese
9e4ac41
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/05-data-types/04-array/article.md
Outdated
| O mesmo vale para o método `push`. | ||
|
|
||
| ## Loops | ||
| ## Laços |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/article.md
Outdated
| ## Não compare arrays com == | ||
|
|
||
| Arrays in JavaScript, unlike some other programming languages, shouldn't be compared with operator `==`. | ||
| Arrays no JavaScript, diferente de outras linguagens de programação, não devem ser comparados com o operador `==`. |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/array-pop.svg
| @@ -1 +1 @@ | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="479" height="148" viewBox="0 0 479 148"><defs><style>@import url(https://fonts.googleapis.com/css?family=Open+Sans:bold,italic,bolditalic%7CPT+Mono);@font-face{font-family:'PT Mono';font-weight:700;font-style:normal;src:local('PT MonoBold'),url(/font/PTMonoBold.woff2) format('woff2'),url(/font/PTMonoBold.woff) format('woff'),url(/font/PTMonoBold.ttf) format('truetype')}</style></defs><g id="array" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="array-pop.svg"><path id="Rectangle-1" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M103 82h35v52h-35z"/><path id="Rectangle-2" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M139 82h35v52h-35z"/><text id="0" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="117" y="112">0</tspan></text><text id="1" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="154" y="112">1</tspan></text><path id="Rectangle-3" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M175 82h35v52h-35z"/><text id="2" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="190" y="112">2</tspan></text><path id="Rectangle-4" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M211 82h35v52h-35z"/><text id="3" fill="#C06334" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="226" y="112">3</tspan></text><text id=""Apple"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 114.044 48.948)"><tspan x="84.544" y="53.448">"Apple"</tspan></text><text id=""Orange"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 151.053 44.448)"><tspan x="117.053" y="48.948">"Orange"</tspan></text><text id=""Pear"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 187.535 52.448)"><tspan x="162.035" y="56.948">"Pear"</tspan></text><text id=""Lemon"" fill="#C06334" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 229.044 48.948)"><tspan x="199.544" y="53.448">"Lemon"</tspan></text><text id="length-=-4" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="8" y="59">length = 4</tspan></text><path id="Shape" fill="#C06334" d="M306 137l9-16.606h-6V78h-6v42.394h-6z" transform="rotate(-90 306 107.5)"/><text id="clear" fill="#C06334" font-family="OpenSans-Regular, Open Sans" font-size="14" font-weight="normal"><tspan x="287" y="96">clear</tspan></text><path id="Rectangle-7" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M363 82h35v52h-35z"/><path id="Rectangle-5" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M399 82h35v52h-35z"/><text id="-1" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="377" y="112">0</tspan></text><text id="-2" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="414" y="112">1</tspan></text><path id="Rectangle-6" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M435 82h35v52h-35z"/><text id="-3" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="450" y="112">2</tspan></text><text id=""Apple"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 374.044 48.948)"><tspan x="344.544" y="53.448">"Apple"</tspan></text><text id=""Orange"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 411.053 44.448)"><tspan x="377.053" y="48.948">"Orange"</tspan></text><text id=""Pear"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 447.535 52.448)"><tspan x="422.035" y="56.948">"Pear"</tspan></text><text id="length-=-3" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="263" y="59">length = 3</tspan></text></g></g></svg> No newline at end of file | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="479" height="148" viewBox="0 0 479 148"><defs><style>@import url(https://fonts.googleapis.com/css?family=Open+Sans:bold,italic,bolditalic%7CPT+Mono);@font-face{font-family:'PT Mono';font-weight:700;font-style:normal;src:local('PT MonoBold'),url(/font/PTMonoBold.woff2) format('woff2'),url(/font/PTMonoBold.woff) format('woff'),url(/font/PTMonoBold.ttf) format('truetype')}</style></defs><g id="array" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="array-pop.svg"><path id="Rectangle-1" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M103 82h35v52h-35z"/><path id="Rectangle-2" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M139 82h35v52h-35z"/><text id="0" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="117" y="112">0</tspan></text><text id="1" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="154" y="112">1</tspan></text><path id="Rectangle-3" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M175 82h35v52h-35z"/><text id="2" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="190" y="112">2</tspan></text><path id="Rectangle-4" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M211 82h35v52h-35z"/><text id="3" fill="#C06334" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="226" y="112">3</tspan></text><text id=""Apple"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 114.044 48.948)"><tspan x="84.544" y="53.448">"Apple"</tspan></text><text id=""Orange"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 151.053 44.448)"><tspan x="117.053" y="48.948">"Orange"</tspan></text><text id=""Pear"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 187.535 52.448)"><tspan x="162.035" y="56.948">"Pear"</tspan></text><text id=""Lemon"" fill="#C06334" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 229.044 48.948)"><tspan x="199.544" y="53.448">"Lemon"</tspan></text><text id="length-=-4" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="8" y="59">length = 4</tspan></text><path id="Shape" fill="#C06334" d="M306 137l9-16.606h-6V78h-6v42.394h-6z" transform="rotate(-90 306 107.5)"/><text id="clear" fill="#C06334" font-family="OpenSans-Regular, Open Sans" font-size="14" font-weight="normal"><tspan x="281.5" y="96">limpar</tspan></text><path id="Rectangle-7" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M363 82h35v52h-35z"/><path id="Rectangle-5" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M399 82h35v52h-35z"/><text id="-1" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="377" y="112">0</tspan></text><text id="-2" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="414" y="112">1</tspan></text><path id="Rectangle-6" fill="#FBF2EC" stroke="#DBAF88" stroke-width="2" d="M435 82h35v52h-35z"/><text id="-3" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="450" y="112">2</tspan></text><text id=""Apple"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 374.044 48.948)"><tspan x="344.544" y="53.448">"Apple"</tspan></text><text id=""Orange"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 411.053 44.448)"><tspan x="377.053" y="48.948">"Orange"</tspan></text><text id=""Pear"" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal" transform="rotate(-89 447.535 52.448)"><tspan x="422.035" y="56.948">"Pear"</tspan></text><text id="length-=-3" fill="#AF6E24" font-family="PTMono-Regular, PT Mono" font-size="14" font-weight="normal"><tspan x="263" y="59">length = 3</tspan></text></g></g></svg> No newline at end of file |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/10-maximal-subarray/solution.md
Outdated
| # Solução lenta | ||
|
|
||
| We can calculate all possible subsums . | ||
| Podemos calcular todas as somas parciais possíveis . |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/article.md
Outdated
|
|
||
| arr.length = 5; // return length back | ||
| alert( arr[3] ); // undefined: the values do not return | ||
| arr.length = 5; // retorna o length de volta |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/article.md
| ## Métodos pop/push, shift/unshift | ||
|
|
||
| A [queue ](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is one of the most common uses of an array. In computer science, this means an ordered collection of elements which supports two operations : | ||
| Uma [fila ](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) é um dos usos mais comuns de um array. Em ciência da computação, isso significa uma coleção ordenada de elementos que suporta duas operações : |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/5-array-input-sum/solution.md
Outdated
| @@ -1,4 +1,4 @@ | ||
| Please note the subtle, but important detail of the solution. We don't convert `value` to number instantly after `prompt`, because after `value = +value` we would not be able to tell an empty string (stop sign) from the zero ( valid number ). We do it later instead . | ||
| Observe o detalhe sutil, mas importante, da solução. Não convertemos `value` para número logo depois do `prompt`, porque depois de `value = +value` não conseguiríamos mais distinguir uma string vazia (sinal de parada) do zero ( número válido ). Fazemos isso mais tarde, em vez disso . |
View reviewed changes
Comment thread 1-js/05-data-types/04-array/article.md
Outdated
| - Fill the array in the reverse order, like `arr[1000]`, `arr[999]` and so on . | ||
| - Adicionar uma propriedade não numérica, como `arr.test = 5`. | ||
| - Criar buracos, tipo: adicionar `arr[0]` e depois `arr[1000]` ( e nada entre eles ). | ||
| - Preencher o array na ordem reversa, tipo `arr[1000]`, `arr[999]` e assim por diante . |
Apply review feedback from @gabifs
377daa2
- Revert the hand-edited array-pop.svg/array-shift.svg back to the original and regenerate them from images.yml via the gulp translation pipeline instead, per the project's standing rule of never hand-editing SVGs; verified visually that both render correctly - Add explicit anchor [#loops] to "## Laços" so the existing <info:array#loops> link from 02-first-steps/13-while-for keeps working - Fix dropped qualifier: "diferente de outras linguagens" (implies ALL others compare by value) -> "diferente de algumas outras linguagens" - Fix misleading comment: "retorna o length de volta" (sounds like it returns something) -> "restaura o length original" - Standardize informal "tipo" -> "como" (2 occurrences) - Standardize "somas parciais" -> "subsomas" in 10-maximal-subarray/solution.md to match the term used in _js.view/test.js, avoiding confusion with "soma parcial" (the `partialSum` accumulator, a different concept covered later in the same file) - Fix dangling "mais tarde, em vez disso" -> "em vez disso, fazemos isso mais tarde" Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
diogoosz commented Nov 21, 2026
Copy link Copy Markdown
Contributor
Author
|
Obrigado, @gabifs ! Peço desculpas pela reincidência nos SVGs editados à mão -- revertidos |
5fa4fe6
into
javascript-tutorial : master
Nov 21, 2026
1 check passed
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment