Check out a free preview of the full JavaScript: From Fundamentals to Functional JS, v2 course:
The "_.map() Exercise" 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:

In this exercise, students take a list of weapons and make them "broken" by mapping over them.

Get Unlimited Access Now

Transcript from the "_.map() Exercise" Lesson

[00:00:00]
>> Let's use it. We have a array of weapons, we have a candlestick, a lead pipe, and a revolver. We also have this function called makeBroken. What it does is it takes an item and it returns a broken item by prepending it with the word [LAUGH] broken. So, what we wanna do is we want a, Array, we want an array of broken weapons.

[00:00:33] We're pacifists here, okay? We make functions that break them. And, how might we do that? Let's take 5 minutes, To do that. One tip is that I don't think there's underscore here. There's kombuchas here, do you guys see this? What is that? Does anyone know what that is?

[00:01:04]
>> [INAUDIBLE]
>> That is funny.
>> [INAUDIBLE]
>> Something's tracking me. Okay, so looks like we don't have underscore. We have some other things. So if you want to use underscore map, what I do and I also do this with jQuery, if I want to just test something really quick, I just go to the underscore js website.

[00:01:39] We don't wanna go to the docs cuz then you can see it. And you just open it, and it will have it. So that's a tip, you can just come here if you don't wanna like set up a library and all that, you don't already have it, can do that and most libraries will let you do this.

[00:01:57] So you guys got your task, we're gonna take these weapons, we're gonna make them broken by mapping over them.