SHARE
TWEET

Untitled

a guest Oct 10th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const pokemon = {
  2.   name: 'Squirtle',
  3.   type: 'Water'
  4. };
  5.  
  6. const { abilities = [], ...rest } = pokemon;
  7. const fullSquirtle = { ...rest, abilities };
  8.  
  9. console.log(rest); //Result: { name: 'Squirtle', type: 'Water' }
  10. console.log({ fullSquirtle }); //Result: { name: 'Squirtle', type: 'Water', abilities: [] }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top