Alternate solution to: Use the map Method to Extract Data from an Array

Hello all,

I’ll preface this by saying please somebody correct me if any of the below is wrong or misleading, I may still not properly understand things!

This module is the first time that, after having been stuck on a challenge, investigating the hints and people’s solutions and explanations in the forum here did not help me grok the concept. I could find no examples of people fully breaking the problem down , including in the hints, and all incomplete explanations I found used arrow functions which I think obscured my understanding of how .map works.

Here is the solution I eventually came to after digging around on other sites and forums and reading more about object destructuring, arrow functions, and the .map method.

const ratings = watchList.map(function (obj) {
   let title = obj.Title;
   let rating = obj.imdbRating;
   return {title, rating}
})

Obviously this sacrifices density for clarity, but it helps me to understand how .map iterates over the array much more clearly, and also more clearly shows how the objects are being destructured and returned. It also makes it more clear to me that .map needs to take a function, which I initially did not fully understand, and that the first parameter of that function is where each object (in our array of objects) is passed in as an argument (at least I think that is how it works!).

It would maybe be cool to see the problem broken down a bit more in the exercise or hints, without the space saving code, to help other simpletons like myself avoid this in future.

It may also be that it was so hard because it is the first challenge I encountered that required a good understanding of concepts like arrow functions and destructuring only briefly explored way back in the ES6 module.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: Functional Programming - Use the map Method to Extract Data from an Array

Link to the challenge:

Hi @harrycook ,

Good job on your advancement! Now concerning this matter, I would first like to point out that everyone’s learning style is different. If you find it difficult to grasp what is being explained to you here, then the correct step to take would be to ask for further explanation, or conduct further research into the topic until you are able to get a grasp of the issue; which you have done and have now gained your own understanding of the topic, and can now hopefully explain to others here who you find having the same issue that you were faced with.

I would also like to point out that, when it comes to challenges, the FCC forum will actively avoid telling you the answer outright. Instead, the members will try to point you in the right direction to figure out the answer yourself. If you are going astray in your reasoning, then we will try to guide you back on the right path. But as I said, sometimes research is needed to further develop your understanding.

Lastly, I would like to mention again that everyone learns differently, and we should use the various resources available to us to fit that learning style. For example, while I think that the FCC’s JavaScript course is very helpful, I have been using an external source that better fits my learning style to learn JavaScript. I will still come back here though to practice and reinforce what I have learned during, and after I am done with that course.

In a nutshell, I guess what I am trying to say is we should take the necessary steps on our end to improve upon our understanding as we learn to become coders. You have done so with this topic, and I commend you for that.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.