Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created September 23, 2019 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/db89365577f15673d8dd20370547ca52 to your computer and use it in GitHub Desktop.
Save NyaGarcia/db89365577f15673d8dd20370547ca52 to your computer and use it in GitHub Desktop.
Destructuring with the rest parameter
const pokemon = {
id: 1,
name: 'Squirtle',
type: 'Water'
};
const { id, ...rest } = pokemon;
console.log(rest); //Result: { name: 'Squirtle', type: 'Water' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment