Tell us what’s happening:
Month 8 of Javascript and Functional Programming is kicking my butt.
Your code so far
this is not my code… I’m just trying to understand this example that passes the test, as nothing I write passes.
filter is returning the correct output even though no parseFloat is being used to turn 8.0 rom a string to an interger… that’s the first question.
const filteredList = watchList
.filter(movie => movie.imdbRating >= 8.0)
.map(movie => ({ title: movie[“Title”], rating: movie[“imdbRating”] }));
WARNING
The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.
You will need to take an additional step here so the code you wrote presents in an easy to read format.
Please copy/paste all the editor code showing in the challenge from where you just linked.
It’s better if you try your own code and if it doesn’t pass then you can paste it in here and we can help you figure it out.
When you want to return an object from a single line arrow function then you have to wrap it in parens because otherwise the curly braces for the object would be seen as denoting a function body instead of an object.
This sort of confusion about what happens isn’t exactly uncommon when you find an answer and copy-paste it.
I highly, highly, highly recommend you show us code you tried and understand. Its much easier for us to try to help you build to a correct answer from what you understand instead of helping you decipher an answer you found.
It is. The number 10 is greater than the number 8.
In JS, the string 10 is less than the string 8 because comparing strings does not work the way we think it should when those strings represent numbers. You can easily test this in your browser’s console. Try typing:
and I understand this concept… I think that’s what is making the 10 > 8 example is so confusing. Yes, they are strings and are evaluated differently. And the test says I MAY have change the strings to numbers. But “It still works because there are no ratings like "10.0" that would not get filtered.” is a double negative my brain can’t compute…
If I press Help it says" If you’ve already tried the Read-Search-Ask method, then you can ask for help on the freeCodeCamp forum."
and Before making a new post please see if your question has already been answered on the forum.
So I was reluctant for 8 month, lol …
I watched a tutorial and saw that I left out my If statement …
Yea, you should use Read-Search-Ask, and part of that reading/searching is making sure you have read around on the forum. But ASK is a very important part of Read-Search-Ask.
The only reason I’m asking is because of your awesome support and encouragement ,Sir…
I will continue to grind it out and ask you questions when I get stuck.
The last time I learned to code it was on a TRS-80 in BASIC in 1984. : D