This course has been updated! We now recommend you take the JavaScript: From First Steps to Professional course.

Check out a free preview of the full JavaScript: From Fundamentals to Functional JS, v2 course:
The "List Transformations" Lesson is part of the full, JavaScript: From Fundamentals to Functional JS, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Bianca introduces list transformations, which is to take a list or collection of data and extract specific portions of that data by looping or other logic. Using this functional utility is useful when dealing with APIs.

Get Unlimited Access Now

Transcript from the "List Transformations" Lesson

>> Next thing we're gonna talk about is list transformations, which is one of the core things that you will be doing in functional utility methods which just take a list or a collection of data and different arrangements. And then extract data from them similarly to how we're using destructuring, but also by looping through it and using various logic to get what we need from it.

[00:00:32] A lot of times, especially if you're working on the front end, you're stuck with using an API, that you don't really have any control over. And the data that you're getting back isn't always in the form that you need it to be in. And so, using these functional utility methods to transform these lists into something that is more usable, or works better for how your UI is arranged, is something you have to do every day.

[00:01:00] Are you guys doing that everyday in your jobs? Or you have pretty good APIs that give you what you need. Anyone? Does anyone work with JSON data at work? Yeah. Cool, okay. So, we talked a little bit about nesting. Here's an example from earlier, when we were talking about making that game object.

[00:01:30] Here, we're just happened to be using the bracket notation with strings. All right. Here we're pushing. And this is what our object literally looks like. I like to have a visual here so that we can kind of keep track of what the object looks like as we're manipulating it.

[00:01:54] Okay, so we can push and we can also use just a regular array bracket with the number thing, okay? Awesome. What's game suspects gonna return? How about gray sweater that button up
>> Under suspects?
>> Yep, can you see that there's a question mark next to it?
>> Yeah, it should Return the object.

>> Which object?
>> The suspects object.
>> Suspects array.
>> The array of,
>> What do you think?
>> It looks to me like it's gonna return that array of objects. Name, color.
>> I'm gonna tell you that you're wrong. Do you forgive me? So, unfortunately we're not using our.

[00:03:17] Yeah, we're using air quotes so it wasn't gonna do anything that we wanted it to do. But now, well Yeah, you guys see that? So, here we are, it's gonna return the array with the suspect objects in them.