Kyle walks through the solution to exercise 3. The solution is located in the file ex3-fixed.js.
- Let's talk about EX3 fixed.…Just to keep things short and sweet…I will just show…the fixed version…but I'll talk you through it.…So, what I decided was to do object destructuring…on the parameter that comes into the response…because remember if a response is receiving an object,…so let's go ahead and just destructure it…while it's coming in.…This lets me not have to do any let or block scoping…to contain those temporary variables…'cause they're just gonna be contained…within the response function itself anyway.…
So, I'm gonna have a foo variable…that defaults to whatever default stuff foo is…and a bar that defaults to defaults.bar.…I'm gonna grab baz as is which is just an array,…and then I'm gonna do these destructurings…down inside of bam.…Don't forget to put on your default objects…so that your destructuring gracefully fails, k?…Now, to do the restructuring,…I can use those concise properties…because I named them all exactly the same…as the properties,…so it's just foo bar baz…and then the qux and qam are inside of the bam object.…
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.