Check out a free preview of the full Functional-Light JavaScript, v3 course

The "Object Filter & Reduce Exercise" Lesson is part of the full, Functional-Light JavaScript, v3 course featured in this preview video. Here's what you'd learn in this lesson:

Kyle instructs students to implement filter and reduce methods for objects.

Preview
Close

Transcript from the "Object Filter & Reduce Exercise" Lesson

[00:00:00]
>> Kyle Simpson: All right, so now that we've seen that we can apply an operation like map to a data structure, it's time for an exercise where we get to practice with the other operations applied to a data structure. So in this particular exercise, the first part is for you to implement a filter and a reduce that can work against our object.

[00:00:24]
Just like we did in the slides just a moment ago in the lecture, what we wanna do now is have a filter and a reduce that work alongside the map that was provided in the slides. So that's gonna be part one of this exercise. You wanna take a look at the other functions.

[00:00:38]
This Read Me says, take a look at listSum and listProduct and kinda see how the exercise is working. But primarily, what you're focused on is implementing a filter object and a reduce object. And when you run the completed code, it should print out that number 38886, okay? So in the exercise, you'll notice that we have this object with some arrays in it.

[00:01:01]
And we have this set of code that is running a filter object, a map object, and a reduce object. And it should end up producing 3886. The provided function map object as we saw in the slides is here for you, you need to take that same pattern and implement filter object and reduce object in the same or in a similar way.

[00:01:26]
That's part one of the exercise. Then part two of the exercise, you're going to be doing some point-free refactoring and using some of the things, so there will be some more review here.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now