Learn how to use destructuring to assign array elements to multiple independent variables with minimal syntax.
- [Instructor] Assignment in ES5 is basically a…singular affair.…When assigning, there's only one variable…on the left-hand side.…ES6 introduces destructuring, which allows you to take…objects or arrays and assign to multiple…left-hand side variables.…You can both assign to independent variables…as well as object properties.…In practice, it removes a lot of boilerplate…and makes code easier to read.…In ES5, assigning independent variables…from an array involves referencing individual elements…by their array index.…
When assigning multiple variables, there's a lot…of redundancy with this approach.…Now, in ES6, we can use destructuring to make…this simpler.…Declare the variables to be assigned to on the left side,…surrounded with array brackets and then assign the…array on the right side.…Each element in the array will be assigned, in order,…to a variable at the same location.…So, the first array element will be assigned…to the first variable, and so on.…Array destructuring is triggered by the presence…of the array brackets on the left-hand side…
- Using arrow functions
- Using default parameters
- Reviewing the class structure in ES6
- Assigning variables with let and const
- Array destructuring and object destructuring
- Replacing callbacks with promises
- Keeping values unique with Set
- Dropping the prototype with Map
- Working with generators
- Using yield with arguments
Skill Level Intermediate
Building a Website with Node.js and Express.jswith Ray Villalobos3h 16m Intermediate
Node.js: Test-Driven Developmentwith Alexander Zanfir33m 13s Intermediate
Learning NPM the Node Package Managerwith Ray Villalobos35m 10s Intermediate
Building a Web Interface with React.jswith Ray Villalobos1h 21m Intermediate
3. Promises and Collections
4. Iterators and Generators
Next steps1m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.