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 - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
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
-
-
-
-
-
Basics of functional data manipulation3m 38s
-
(Locked)
The spread operator8m 6s
-
(Locked)
Using the map() function6m 29s
-
(Locked)
Using the filter() function5m 40s
-
(Locked)
Using the every() and some() functions9m 18s
-
(Locked)
Preventing mutation with the slice() function8m 45s
-
(Locked)
Using the sort() function6m 55s
-
(Locked)
Using the reduce() function6m 50s
-
(Locked)
Combining array functions6m 10s
-
(Locked)
Solution: Recreating the map() function3m 11s
-
-
-
-