Created
April 17, 2018 14:57
-
-
Save codermarcos/137eb2fe2328f558cb0a1eb220cbd941 to your computer and use it in GitHub Desktop.
Testando copia sem referencia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pessoa = { | |
nome: 'Marcos', | |
contatos: { | |
email: 'coder.marcos@gmail.com' | |
} | |
}; | |
var clone = { | |
nome: pessoa.nome, | |
contatos: pessoa.contatos | |
}; | |
pessoa.idade = 19; | |
console.log('pessoa', pessoa); | |
// "pessoa" Object { nome: "Marcos", contatos: {…}, idade: 19 } | |
console.log('clone', clone); | |
// "clone" Object { nome: "Marcos", contatos: {…} } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment