Result looks OK, but still fails the fourth condition of the challenge

My output looks the same as the expected result, but still fails to pass the 4th condition of the module.

// Only change code below this line
var mapList = [];
var filteredList = [];

filteredList = watchList.filter(
    if (Number(item.imdbRating) >= 8) {
      return {'title': item.title, 'rating': item.imdbRating}    

mapList = {
    return {'title': item.Title, 'rating': item.imdbRating}

var number = 33;

var number2 = 11;

// 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/85.0.4183.121 Safari/537.36.

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

Link to the challenge:

note that that test starts with

filteredList should equal

check your filteredList variable

Thank you for the reply! Yes, I realized this much later myself after I paid more attention to the question. I was passing the return value to another variable instead of filteredList. The confusion came about because I used the filteredList variable as a placeholder for the filter( ) function which I then pass to the map( ) function. Anyway, thanks heaps.

This might help:

var number = 33;
console.log(typeof(number)) //number

know you can chain methods! watchList.filter(...).map(...)

great stuff! thanks for the tip, didn’t know this until now :slight_smile:

Yeah, I tried string( ) too but it didn’t work (at least for the exercise, works on REPL). Also, I wanted to avoid double conversions(unsafe practice imo) so I only converted the variable for the sake of comparison to >= 8, and leave the output as it is. Thanks.