Day 29: Mopping up
Lesson 3: Destructuring
Let's start with the easier one.
Let's say you have an object and you want to access all the properties of it.
Having to access all the properties with
pokemon. isn't the worst thing but it is a little cumbersome.
Instead we can declare all of those as variable and destructure the pokemon object into the,
This might not seem like the biggest win in this tiny example but trust me it's really handy.
You also don't need to grab all the properties, just the ones you want.
The names on your destructuring must match the name of the property in the object.
You can also do this with arrays as well, here the position is what matters and you can call them whatever you like.