How to remove backlashes from output?

How to remove backlashes from output?
0

I am doing the Functional Programming: Use the map Method to Extract Data from an Array challenge and I am stumped. I can get an output but everything I try that shows results always looks like this and fails the last check,

“[{“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”}]”

I have tried using the solutions on the hint page, I tried looking for solutions on the forms and on other websites. I even tried watching youtube videos to see if I am missing a step. I can see that when they put the code in it works for them, but not for me. Is it possible that its a browser issue? I am using chrome.

At this point, I have been trying for 2 days to get this working, but I don’t know what else I can try. I am going to have to skip this one and go on to the next.

Here is the current code I am using.

const rating= watchList.map(item => ({
title: item[“Title”],
rating: item[“imdbRating”]
}));

Please provide a link to this challenge.

1 Like

The last test tells "ratings should equal", I don’t see variable ratings in your code

1 Like

I think I figured it out. I had to change the code under the “// Add your code above this line” part from rating to ratings. After that my original try worked.

console.log(JSON.stringify(rating));

Was this a typo?

Here is a link to the challenge.

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

1 Like

@Lemonz-418 Yes, that is a typo in the challenge. I have submitted a pull request (PR #37863) to change rating to ratings. Thanks for pointing that out.