Created
January 6, 2019 17:59
-
-
Save oliversd/cbff7e618a6552f4a6226927e315a9d3 to your computer and use it in GitHub Desktop.
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
let dog = {name: 'Toby', age: 3, race: 'Beagle', size: 'small'} | |
let puppy = {…dog, name: 'Max', age: 1}; // Clone dog object and modify its properties | |
console.log(puppy); // {name: 'Max', age: 1, race: 'Beagle', size: 'small'} | |
console.log(dog); // {name: 'Toby', age: 3, race: 'Beagle', size: 'small'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment