Map method to extract data from array

let rating = watchList.map((item) => ({"title" :item["Title"], "rating": item["imdbRating"]}));
if we do console.log (rating) we get output as [object Object] so on and so forth. Why am i not able to get desired output?

Please follow the link for the challenge, it was not getting posted conventionally.
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array

Just copy pasted your code and it passed all tests.

It passes the test , true, but I am not able to understand why we are not seeing the desired output .

It is the correct output, but since the FCC console can’t display full objects because it transforms the output to a string representation; the toString() output of an object is [object Object]. Raw console output looks like this:

image

1 Like