Check out a free preview of the full Introduction to JavaScript course:
The "map Method" Lesson is part of the full, Introduction to JavaScript course featured in this preview video. Here's what you'd learn in this lesson's course:

Brian codes a map function and explains its usefulness.

Get Unlimited Access Now

Transcript from the "map Method" Lesson

>> Brian Holt: Map is one of the more common ones. Whenever you have an array of something and you wanna transform it into an array of something else, like maybe you have an array of numbers and you wanna transform that into an array of those numbers doubled or something like that, then map is a really good way of doing that.

>> Brian Holt: So just to kind of drive that home, if I just return 5 here and const newCities = blah,
>> Brian Holt: Get rid of city, so notice that everything is just 5, cuz it's just keeping whatever I return here, so whatever I return there is what's gonna be put to the new array.

>> Brian Holt: Now this is a relatively pointless action. I don't know why you wanna transform an array of cities into an array of 5s, but you can [LAUGH]
>> Speaker 2: How would that affect memory though, because it could be off like two arrays and take more space.
>> Brian Holt: In general, that won't be a problem.

>> Brian Holt: I would say it's gonna create and trash a bunch of arrays. That's the nature of the beast. However, you're gonna have to work in pretty large volumes for that to make any difference.
>> Brian Holt: So that's something to check out. Again, Kyle Simpson has another course, as well as Brian Lonsdorf on Frontend Masters on functional programming that are phenomenal.

If this peaks your interest in learning to code like this like it does for me, definitely worth checking out, and getting more familiar with. 4-H and math or just like the tip of the iceberg there.