Last active
February 11, 2020 14:27
-
-
Save AllGistsEqual/a34f62f6d3bc3cb5a4a6c010856beecc 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
// create a cube from a square | |
const square = { x: 5, y: 10 } | |
const cube = { ...square, z: 12 } | |
console.log(square) // { x: 5, y: 10 } | |
console.log(cube) // { x: 5, y: 10, z: 12 } | |
cube.x = 10 | |
console.log(square) // { x: 5, y: 10 } | |
console.log(cube) // { x: 10, y: 10, z: 12 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment