From the course: Learning Functional Programming with JavaScript ES6+

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Combining array functions

Combining array functions

- [Instructor] Okay, well, at this point, we've learned about a number of different declarative functions that can help us manipulate data in a more functional way. So the next thing that we're going to take a look at here is how we can combine these functions to achieve more complex functionality. So what you see here, and you can find this in the beginning state of the exercise files if you want to follow along. But what you see here is an array containing a number of objects representing career data about different people, let's say at our company, all right? Well, there's a lot of different questions that we might want to ask just about this simple array. And as we'll see, the functions that we've learned about in this chapter can help us do so. So the first thing that we might want to know is what is the average salary of all of the people working at our company? Well, this one can be achieved pretty easily by combining map and reduce. Here's what that's going to look like. We're…

Contents