Loading
Current section: 4. Destructuring 4 exercises
lesson

Intro to Destructuring

Loading lesson

Transcript

00:00 Hey. Welcome to the destructuring exercise. One of my favorite features of JavaScript and, it's maybe some maybe the reason that some of these features I say are my favorite is because I lived coding JavaScript before these features existed and they just made a really big positive influence on my life. And so anyway, I love destructuring. It simplifies a lot of things.

00:23 So the basic idea is rather than assigning variables individually one at a time, you can actually pluck off, the properties off of an object, all at once with a single variable declaration, which is quite nice for a lot of situations. You can also do this with arrays. You can grab the different numbers. You can skip elements, which is pretty cool. And you can also use rest.

00:49 You can do the same actually with object destructuring too, the rest of the user and it will give you the user except without the name and h properties. It's pretty cool. And, yeah. I use this a lot in function parameters. This is where I primarily am using, destructuring is in function parameters.

01:09 It's It's very nice for like options, objects, and stuff like that. So anyway, that's all that I'm gonna share with you right now. Why don't you jump into this and we'll see you in the exercise.