Last active
December 20, 2021 13:43
-
-
Save NyaGarcia/2ca5a41746c6cd93f4c10065b0e08581 to your computer and use it in GitHub Desktop.
An example of object mutation in JS
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
const mySquirtle = { | |
name: 'Squirtle', | |
type: 'Water', | |
hp: 100 | |
}; | |
const anotherSquirtle = mySquirtle; | |
anotherSquirtle.hp = 0; | |
console.log(mySquirtle); //Result: { name: 'Squirtle', type: 'Water', hp: 0 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment