Three questions:
Is the function seen here using “arrow function” syntax?
can it be described as an anonymous function?
Why is the object being returned in parenthesis?
item => ({title: item["Title"], rating: item["imdbRating"]})
Challenge: Functional Programming - Use the map Method to Extract Data from an Array
Link to the challenge:
its “syntax” really, otherwise its not going to return that “object” for each of those “item”, to simply put if it was used with a “return” statement (as you would in a function) then you would not need that “parenthesis”
hope this was helpful, happy learning
1 Like
I suggest you to take a look a the MDN Web Docs for a great and complete explanation on arrow functions: Arrow function expressions - JavaScript | MDN (mozilla.org)
1 Like
system
Closed
October 6, 2023, 8:15am
4
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.