Last active
February 7, 2020 16:19
-
-
Save AllGistsEqual/986f1524e5e6b277f21b5cac4d27b346 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's separate Hansel from the rest, he will be put in the cage | |
const people = { Hansel: { age: 14 }, Gretel: { age: 10 }, Witch: { age: 99 } } | |
const { Hansel, ...rest } = people | |
console.log(Hansel) // { age: 14 } | |
console.log(rest) // { Gretel: { age: 10 }, Witch: { age: 99 } } | |
// let's draw cards from a deck | |
const deckOfCards = ['sevenOfClubs', 'aceOfSpades', 'queenOfHearts'] | |
const [topCard, ...restOfCards] = deckOfCards | |
console.log(topCard) // 'sevenOfClubs' | |
console.log(restOfCards) // ['aceOfSpades', 'queenOfHearts'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment