Functional programming: use filter method to extract data(1)

Tell us what’s happening:
hello, I am having trouble finding a solution to this code. I’m trying to convert the string to a float inside the filter method.

Your code so far

// Only change code below this line

var filteredList = watchList
.map(dept => ({ title: dept["Title"] ,  rating:dept["imdbRating"]}))
.filter(num => num.length >= 8.0);

// Only change code above this line


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.51.

Challenge: Use the filter Method to Extract Data from an Array

Link to the challenge:

Hi! It isn’t num.length that you’re trying to filter with - it’s the value associated with the key rating in each object…

1 Like

num is not something that has a length, it is an object. Try to add console.log(num) in here to see what it is

I see where the problem was. This has worked.

.filter(num => num.rating >= 8.0);

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