Objects with nested object values can be destructured as well. Kyle walks through a brief example where the foo function generates a nested object which needs to be destructured. He also talks about assigned default object values.
- Of course, if we have an object…at one of those positions…like for example up here,…if in the D position it is it's own object…and that has an E property on it of the value,…four for example, we can do,…nested object de-structuring…just like we can do nested array de-structuring.…So here, instead of putting…just D by itself,…I'm going to need to do the D property, colon,…but instead of having a lexical variable…for it to be targeted at,…think about this processing wise,…what I now need is a de-structuring pattern…for it to be targeted at.…
So I'm going to put my de-structuring pattern there.…So now here's my de-structuring pattern…now I have an E variable that is the value four.…- (Male) So in this particular set up,…could you also have…an additional assignment to D?…- Yes, absolutely.…We hadn't gotten to that, but since you asked,…you can't really straightforwardly do that with arrays…but with objects we can account for D…a whole bunch of different times if we wanted to.…
There we have assigned off whatever was in D,…
This course was created by Frontend Masters. It was originally released on 01/10/2017. We're pleased to host this training in our library.
- The arrow function
- Arrow function variations
- Closures and explicit blocks
- Default values
- Using the gather and spread operators
- Dumping variables
- Concise properties and methods
- Symbols, iterators, and generators
- Optimizing codes for the reader
Skill Level Intermediate
1. Arrow Functions
2. Block Scope
3. Default Values and the Gather/Spread Operators
5. Template Strings
6. Symbols, Iterators, and Generators
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.