Objects references and copying by matdomis · Pull Request #223 · javascript-tutorial/pt.javascript.info
Repository navigation
Objects references and copying - #223
Closed
matdomis wants to merge 11 commits into javascript-tutorial:master from matdomis:master
Closed
Objects references and copying #223 matdomis wants to merge 11 commits into javascript-tutorial:master from matdomis:master
Conversation
matdomis commented Sep 2, 2021 · edited Loading
Copy link Copy Markdown
I've not translated the code variables (but the comments I did of course) because It's ok to write and read code in english.
matdomis added 3 commits September 2, 2021 12:03
Object references and copying
317a62c
Objects references and copying
079b171
Objects reference and copy
095ac89
javascript-translate-bot
added
the
review needed
label
Sep 2, 2021
CLAassistant commented Sep 2, 2021 · edited Loading
Copy link Copy Markdown
|
|
Put back formatting.
3aa40e5
Update formatting.
23f071e
Add blank line.
ddb06b5
Remove blank line.
d4b9a35
Remove blank lines.
8721090
Put back formatting.
c6562a8
Put back formatting and words.
feb1938
odsantos
requested changes
Sep 14, 2021
View reviewed changes
odsantos left a comment · edited Loading
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Hello @matdomis ,
Here is a review.
Please, keep special formatting characters (such as ! ) and blank lines for conforming to the original file, and feel free to comment where you might disagree.
Thank you.
Comment thread 1-js/04-object-basics/02-object-copy/article.md| Vamos começar com um primitivo, como uma string. | ||
|
|
||
| Here we put a copy of `message` into `phrase`: | ||
| Aqui colocamos uma copia de `message` para `phrase`: |
|
|
||
| As a result we have two independent variables, each one storing the string `"Hello!" `. | ||
| Como resultado nós temos duas variáveis independentes, cada uma armazenando uma string `"Hello!" .` |
| ``` | ||
|
|
||
| It might seem that the line ` (*) ` would cause an error, but it does not. The value of `user` is constant, it must always reference the same object, but properties of that object are free to change . | ||
| Pode parecer que a linha (*) causaria um erro, mas não causa. O valor de `user` é constante, precisa sempre referenciar o mesmo objeto, mas propriedades desse objeto são livres para serem alteradas . |
| Em outras palavras, o `const user` dá um erro apenas se tentarmos definir `user=...` como um todo | ||
|
|
||
| That said, if we really need to make constant object properties, it's also possible, but using totally different methods. We'll mention that in the chapter <info:property-descriptors>. | ||
| Dito isso, se realmente precisarmos criar propriedades constantes no objeto, também é possível, mas usando métodos totalmente diferentes. Iremos menconar isso no capítulo <info:property-descriptors>. |
| ## Sumário | ||
|
|
||
| Objects are assigned and copied by reference. In other words, a variable stores not the "object value ", but a "reference " ( address in memory) for the value. So copying such a variable or passing it as a function argument copies that reference, not the object itself . | ||
| Objetos são atribuidos e copiados por referência. Em outras palavras, uma variável armazena não o "valor do objeto ", mas sim sua "referência " ( endereço na memória) para o valor. Então copiar tal variável ou passar ela como um argumento de uma função copia a referência, não o proprio objeto . |
| Objetos são atribuidos e copiados por referência. Em outras palavras, uma variável armazena não o "valor do objeto ", mas sim sua "referência " ( endereço na memória) para o valor. Então copiar tal variável ou passar ela como um argumento de uma função copia a referência, não o proprio objeto . | ||
|
|
||
| All operations via copied references (like adding/removing properties) are performed on the same single object . | ||
| Todas as operações por meio de referências copiadas(como adicionar/remover propriedades) são realizadas no mesmo objeto único . |
| Todas as operações por meio de referências copiadas(como adicionar/remover propriedades) são realizadas no mesmo objeto único . | ||
|
|
||
| To make a "real copy " ( a clone) we can use `Object.assign` for the so-called "shallow copy " ( nested objects are copied by reference) or a "deep cloning" function, such as [_.cloneDeep(obj)](https://lodash.com/docs#cloneDeep). | ||
| Para criar uma "cópia real " ( um clone) podemos usar `Object.assign` para o então chamado "cópia superficial " ( objetos aninhados são copiados por referência) ou uma função de "clonagem profunda", como a [_.cloneDeep(obj)](https://lodash.com/docs#cloneDeep). |
javascript-translate-bot commented Sep 14, 2021
Copy link Copy Markdown
|
Please make the requested changes. After it, add a comment "/done". |
odsantos commented Sep 16, 2021
Copy link Copy Markdown
Contributor
|
Hello @matdomis , Please, when you are able to work on the requested review changes, do not forget the above instruction from the bot. Thank you. |
matdomis commented Sep 18, 2021
Copy link Copy Markdown
Author
|
/done |
odsantos commented Oct 18, 2021
Copy link Copy Markdown
Contributor
|
Hello @matdomis , you marked as '\done' but I still see my last review suggestions. Thanks. |
Merge branch 'master' into master
2224acc
odsantos commented Dec 11, 2022
Copy link Copy Markdown
Contributor
|
Hi @matdomis , Are you no longer available for this one? Thanks, |
nazarepiedady commented Mar 1, 2024
Copy link Copy Markdown
Member
|
@peruibeloko , @jonnathan-ls , do you have time to see what is possible to do in relation to this pull request? |
peruibeloko commented Mar 7, 2024
Copy link Copy Markdown
Contributor
|
@nazarepiedady I'm solving the merge conflicts |
peruibeloko commented Mar 8, 2024
Copy link Copy Markdown
Contributor
|
@nazarepiedady @odsantos @jonnathan-ls the merge conflict is resolved on my fork |
nazarepiedady commented Mar 8, 2024
Copy link Copy Markdown
Member
|
@peruibeloko , you need to do another pull request to be merged. I will close this, and reassign the task to you, because this looks abandoned. |
nazarepiedady commented Nov 28, 2025
Copy link Copy Markdown
Member
gabifs commented Nov 30, 2025
Copy link Copy Markdown
Contributor
|
@nazarepiedady esse artigo já foi traduzido na PR #408 . Vou fechar a PR |
gabifs commented Nov 30, 2025
Copy link Copy Markdown
Contributor
|
Artigo já traduzido #408 |