
JavaScript: From Fundamentals to Functional JS, v2 forEach and _.each Exercises
This course has been updated! We now recommend you take the JavaScript: From First Steps to Professional course.
Transcript from the "forEach and _.each Exercises" Lesson
[00:00:00]
>> So for the exercise, we're gonna first start by implementing the internals of an each function, right? So, just remember that each takes two arguments, a list, and a call back. It's gonna iterate through, each item in that list and call back with the values in that list, one at a time, right?
[00:00:24] So if we have a list of length 3, it's gonna to call the callback 3 times, each with one of those values. Also underscore each works for both arrays and objects. So that's something to consider. Once you finish, you can test it by running it by using it with the exercise from the previous module where we loop through our suspects lists and create a suspect objects.
[00:00:57] So, good luck, also don't forget that this is a little tricky here is that the underscore is gonna be an object.