Why does the challenge hint work without converting a string to float?

Hey! I solved this challenge “Use the filter Method to Extract Data from an Array” on my own and I was comparing my solution to the ones in the hints and my question is why the 2nd solution in the hint works without converting a string to a float as is directed in the challenge instructions (spoiler - hint solution to challenge below):

Note that the rating values are saved as strings in the object and you may need to convert them into numbers to perform mathematical operations on them.

var filteredList = watchList
  .map(function(e) {
    return { title: e["Title"], rating: e["imdbRating"] };
  })
  .filter(e => e.rating >= 8);  /////////// <======================
1 Like

type conversion!

note that you can compare them, but you can’t get the average without converting to numbers

EDIT: gotcha, it doesn’t require anymore to give the average value, it is one of the challenges that was simplified in last update to the curriculum
it seems the note stayed tho
something more for your to learn I imagine

1 Like