Kyle shares an advanced example of destructuring which he often uses in his applications. He destructures a “default” object so the default values are used inside a “config” object. This way, if a configuration variable is not set, it will use the default value.
(Japanese acoustic)…- [Kyle Simpson] This thing I'm about to show you…is basically telling you how to do the exercise,…so you're gonna wanna pay close attention.…This is a huge hint.…Okay?…There's one usage for destructuring…that I have found to kinda be useful,…and it's in the case wherever I have an object,…like, for example, maybe you've had this before.…I have an object that has some properties in it…that represent defaults for some settings,…like maybe for an AJAX call, or something.…
And, then I have config object,…where I'm gonna populate only certain things…that I wanna set,…and what I want is for all the defaults…to kinda get mixed in together…with the ones that I've set.…Anybody been in that scenario before?…And, you've probably used some library or frameworks…like Mixin or jQuery Extend,…or I think Underscore calls it Extenduary,…some utility that mixes objects together in that way.…Right?…You've probably done that before.…The rub is that every framework and utility…does it slightly differently.…Some of them go from left to right.…
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.