# Other sources besides freeCodeCamp to learn Destructuring

I’m really struggling with the destructuring concepts. I haven’t understood one single explanation or challenge without looking up the answer somewhere. Please advise some other resources that I can use please. Thanks!

Do you understand after you look up the answer somewhere? What I mean is after looking at it, can you delete the code and recode the correct solution after you know how to do it?

1 Like

For most of them I feel like I am just remembering the answer and not fully understanding the concepts.

I tried watching this video https://www.youtube.com/watch?v=-vR3a11Wzt0
but I still don’t really understand it.

I found it to be very easy to read with good examples and code snippets for you to study.

2 Likes

Thanks I’m giving it a read now.

For destructing, I think learning by examples is the best way unless you are trying to implement destructing by yourself. Then, use your own understanding to create more examples.

``````// Destructing array
let [a, b] = [1, 2] // a = 1, b = 2
let [a, b] = [1, 2, 3] // a = 1, b = 2
let [a,  , b] = [1, 2, 3] // a = 1, b = 3
let [a, b] = [1] // a = 1, b = undefined

//Destructing object
let {a} = { a: 1, b: 2 } // a = 1
let {a, b} = { a: 1, b: 2 } // a = 1, b = 2
let {a, b, c} = { a: 1, b: 2 } // a = 1, b = 2, c = undefined
let {foo, bar} = { a:1, b: 2} // foo = undefined, bar = undefined

// Cherry picking
let user = {
name: "John",
country: "foo",
city: "bar"
}
}

let {
country,
city
}
} = user

console.log(country, city) // country = foo, city = bar

``````
2 Likes

I agree with @gunhoo93

Consider doing this
After reading up on this make some examples for yourself. Pretend you’re taking notes for a fellow classmate that was sick the week they taught destructuring assignment so you’ll need some comments too. Do that on jsfiddle.net or repl.it or similar so you can see the results easily in a console.

The act of absorbing the information and then having to explain it / demonstrate it will really help stick that content in your memory. (And you’ll have a reference in your own words to fall back on if you forget something later.)

Referencing material outside the FCC lessons is NOT a bad habit to have. That’s being resourceful and curious.

Good luck on this.

2 Likes

Feel like I am finally making progress on this topic after beating my head into the keyboard for several hours. Oh the grind.

@virgilt

Glad to hear you are making progress! And hey, the grind is part of learning something new. As frustrating as it can be, I say embrace the grind. For when you actually do learn something new and the comprehension of what you’ve been studying starts to kick in, it’s a great feeling! Code on!

1 Like

I’m going through the same thing. Fun Fun Function is super helpful as well Destructuring with Fun Fun Function

1 Like

I actually was watching this exact video yesterday. I think what is helping the most is taking the examples from freeCodeCamp and the articles @dream-ardor suggested and trying to “break” them. Basically running my own test to see how it works.

1 Like

Man, I so feel your pain! It took me a good few days of coding and thinking. Mostly thinking, then writing a pseudo-code and then implementing it in the terminal. Use terminal to practice! The good thing about the terminal is that you don’t have any instructions. You’re just forced to do the hard thinking and then typing. It gets easier with every day, bro!

1 Like

The article you suggested is great! Explains everything very clearly.

1 Like

Ok Im going to take a look at the article as well and try to get through it. Good luck!

1 Like

Glad to hear you liked it! Knowing that the link was so helpful to you makes the effort to share worth it. Communities like freeCodeCamp really thrive when it’s members help each other out and are friendly to one another. I hope you have continued learning and success during your coding journey!

1 Like