Exercises: Destructuring Syntax - Javascript In Depth

preview_player
Показать описание
Let's go through some practice exercises together on the destructuring syntax in Javascript together. We will also practice Array, Iterable (map) and Object destructuring as well as destructuring binding/patterns with for...of loops and function parameters.

Chapters:
00:00 Introduction
00:28 Warmup Exercise
04:01 Exercise 1
08:51 Exercise 2
15:54 Exercise 3
26:49 Next Steps

Рекомендации по теме
Комментарии
Автор

Thanks, Thanks, Thanks! God Nader as always.

kinrev
Автор

Well Programming is not just learning but its all about practising. thanx to this course which has a set of practice questions with every concept which makes these concepts permanent in my mind.

shivamgupta
Автор

for exercise 3:

as it turns out I had destructured within the parameter before I had realized it in exercise 3. I've noticed in the past, when asking that we take an object as the argument for a function that you will pass in a placeholder value.

When you asked us to do the same in exercise 3 I had actually passed in the destructured version of the parameter in instead without really knowing I did. It just makes and has made more sense to me that way - to literally think and see "Ok, here's a function... and look at this argument for it: it's literally requesting we pass in an object with 'x' 'y' and 'z' keys". So that's what I did, and I was expecting to have to do something funky like

let xyzCalc = ( let {x, y, z} = xyzCalc ) => { return console.log( 5 * x - 2 * y - z ) };

in an effort to destructure within the parameter for step 4, considering I didn't know I had essentially done that my first go-around (in steps 1, 2, and 3).

let xyzCalc = ( {x, y, z} ) => { return console.log( 5 * x - 2 * y - z) } ;

just reads so much more neatly/intuitively to me, as opposed to something like:

let xyzCalc = (placeholder) => { return console.log(5 * placeholder.x - 2 * placeholder.y - placeholder.z) };.

I'm glad you covered destructuring. It's gonna be handy moving forward and I'm glad my intuition aligned with what's practiced.

tomboolery
Автор

Really good exercises the previous video really helped my understanding of deconstruction, and this video showed me how versatile it is in making code easier to read, and also we can use a lot less code to achieve solutions. It's also really valuable to see that we can use deconstructing in function parameters and for of loops, because previously I had no idea they could be used this way.

KRAKENBACK..
Автор

Thannks Buddy, nice work. its not too easy to find similar content

yuriykulinich