Array destructuring is a common pattern that is used to give names to items in an array by position. In this video, learn how to use array destructuring and the comma to take the place of items in an array.
- [Instructor] Destructuring assignment gives us an easy way … to extract data from arrays and objects … and assign them to variables. … Let's take a look at how destructuring works with arrays. … Here I have an array of cities. … Now if I just wanted to grab a couple of these cities, … I could access them by their index. … So I could say city zero, … that'll give me Spokane. … But a new way to handle this type of access … is to handle it with destructuring. … Let's update cities and instead … I'm going to use the array brackets here … and I'm going to create a variable name. … I'll call it first. … Now I can console log first. … Then that's going to give me the first item … that's in the array. … If I wanted to grab the second item in the array, … I could. … I can console log second and that'll give me Boston. … Now these variable names are whatever you want to name them, … so I could call this fifth, … but that wouldn't mean it's the fifth one. … It just means that I've called it fifth. …
This course was created by Eve Porcello. We are pleased to offer this training in our library.
- What is ECMAScript?
- Writing and searching strings
- Writing maps
- Destructuring arrays
- Searching arrays
- Creating objects
- Destructuring objects
- Iterating with the for/of loop
- Getting and setting class values
- Using ECMAScript functions
- Building and returning promises
- Using async/await syntax
Skill Level Intermediate
1. What Is ECMAScript?
What is ECMAScript?1m 44s
2. ECMAScript Variables and Data Structures
3. Arrays and Array Methods
Destructuring arrays1m 34s
4. ECMAScript Objects
5. ECMAScript Functions
- 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.