Last active
April 29, 2019 18:13
-
-
Save splincode/0318063da32dd2d435f8fe1e138ae1c1 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
const animals = { | |
zebra: { | |
food: ['leaves', 'bark'], | |
name: 'zebra' | |
}, | |
panda: { | |
food: [], | |
name: 'panda' | |
} | |
}; | |
// In order to get a new reference and copy the elements | |
// we just need to do use spread operator | |
const copy = { ...animals }; | |
// Alternative: | |
// const copy = Object.assign({}, animals); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment