Last active
June 25, 2018 15:50
-
-
Save chsami/d78fe00cb491c10e1bc25e5a70b4f7e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| shallowCopyExample() { | |
| let product = { | |
| name: 'beef', | |
| price: 10, | |
| category: { | |
| name: 'food', | |
| type: 'meat' | |
| } | |
| }; | |
| let shallowCopyOfProduct = product; | |
| console.log('[ShallowCopy] Value before edit: ' + product.name); | |
| shallowCopyOfProduct.name = 'Ross beef'; | |
| console.log('[ShallowCopy] value after edit: ' + product.name); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment