Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array

Hi for some reason this lesson is failing but my output is identical to the desired output. Even if I copy paste the solution in it still fails.

My code:

// Add your code below this line

var rating = watchList.map(x => ({
  title: x["Title"],
  rating: x["imdbRating"]
}));


// Add your code above this line

console.log(rating);

Output:

// running tests
ratings should equal [{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}].
// tests completed
// console output

[{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]

Welcome, jvs.

If your solution is correct, and the tests are failing, it is because of one of two things:

  1. Your browser/version is not compatible with the lesson (use a different one).
  2. You have a browser extension that is preventing the tests from passing. Often happens with adblockers. (disable extensions)

You can make sure though, by using your development tools to see the output for your solution. See if there is an error.

Hope this helps.

Small but important - you’re using the variable rating (which I do notice is in the console.log() ), but take a look at the fail message. What variable name is there?

Ah how annoying! Thanks for pointing that out :slight_smile: