Thought I’d break down this solution to make sure I understand each part well.
-
movie =>
, arrow here means movie where function is true (seems I can think of arrow as “where” from now on) - outer layer
()
, is just part of .map function - the second
()
, is used because we’re working on an object? -
{}
, is used because it’s part of the function? -
movie[]
, not sure about this one, at first I thought it could be["Title"]
but it’s because the string is part of movie and the"title"
is just a string not referencing the object variables?
Please let me know if I’m correct, thanks
Your code so far (sorry I forget the way to hide this solution)
var filteredList = watchList
.filter(movie => movie.imdbRating >= '8.0')
.map(movie => ({"title": movie["Title"], "rating": movie["imdbRating"]}));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
.
Challenge: Use the filter Method to Extract Data from an Array
Link to the challenge: