Last active
April 17, 2018 16:39
-
-
Save codermarcos/32a93b60041ce93337c62f3876cfe3a7 to your computer and use it in GitHub Desktop.
Copiando com assign
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' }; | |
var clone = Object.assign({}, pessoa); | |
pessoa.idade = 19; | |
console.log('pessoa', pessoa); | |
// "pessoa" Object { nome: "Marcos", idade: 19 } | |
console.log('clone', clone); | |
// "clone" Object { nome: "Marcos" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment