Need Help With Javascript Learn Asynchronous Programming by Building an fCC Forum Leaderboard, Step #46

Hello coders!

I am having trouble with this particular step. I am not sure what I am doing wrong here, I’ve tried many different ways to write the code but I keep getting stuck with console error message 4. “You should implicitly return user.id strictly equal to poster.user.id”. Any point in the right direction would be appreciated…

Here’s my code:

const avatars = ((posters, users) => {
  return posters.map((poster) => {
    const user = users.find((user) => 
    user.id === poster.user.id ? true : false);
  });
});

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

was the ternary mentioned as something to add in your return statement?

what are the possible values of user.id === poster.user.id?

Yeah, I know, and I did that already. But for some reason when I try to create a help topic via that method, it acts as if I am logged out of the system, and acts as if I am an unregistered, non-donating, guest…

can you descrube or share screenshots/videos of what happens when you create an help post with that method?

Tell us what’s happening:

Hello all,

I am having trouble passing the 4th test criteria on step #46 in the Javascript “Learn Asynchronous … Leaderboard” course. I keep getting the console message:

“4. You should implicitly return user.id strictly equal to poster.user.id”

I have tried all the ways I know to make this work but can’t seem to get past it. My current code is:

user = users.find((user) => user.id === poster.user.id);

I don’t have room to add more of my code here.

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

const avatars = ((posters, users) => {
  return posters.map((poster) => {
    const user = users.find((user) => user.id === poster.user.id);
  });
});


// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15

Challenge Information:

Learn Asynchronous Programming by Building an fCC Forum Leaderboard - Step 46

I signed out of everything and rebooted my computer, I was able to sign into fCC for the coursework, and then I had to manually sign into this forum and it seems to have fixed the issue…I reposted my topic used the ask for help submission within the course itself.

Thank you :slight_smile:

I had tried that first, as I thought that’s what the instructions were asking, but it did not work.

try removing the parenthesis from the parameter

Also, property is poster.user_id

return the result of checking if user.id is strictly equal to poster.user_id

Ok, I’ve tried removing the parenthesis. I’ve checked that I have user.id === posters.users.id and still no success. I still get the same error message. I’m a little confused on what is meant by return the result of user.id === poster.user.id. To me, I read this as you want me to have the function check if a conditional is valid or not. Therefore, my original code was this:

const avatars = ((posters, users) => {
  return posters.map((poster) => {
    const user = users.find((user) => user.id === poster.user.id ? true : false);
  });
});

but I know that doesn’t work so I’ve tried this:


const avatars = ((posters, users) => {
  return posters.map((poster) => {
    const user = users.find(user => user.id === poster.user.id);
  });
});

still doesn’t work. I’ve tried many possible permutations of code but still get stuck with that console message.

Side note - one thing that is majorly confusing me is why in some arrow functions, they must be written as the whole function, i.e.

const myFunction = ((param) => {codeblock});

and why other times the parameter isn’t fully separated, like this:


const myFunction = (param => code);

From my second example of real code above, I tried removing the parenthesis from the parameter as instructed. But why remove them from this particular arrow function when the two other arrow functions in the same “avatar” code block have their parameters isolated? I haver not seen any sort of regularity when it comes to applying parameters either with or without isolation. If anybody could explain why, I think I might not encounter problems like I’m having on this step anymore.

Or maybe it’s the particular way they are evaluated - I don’t know. Anyway, I’m still stuck on this step.

Thank you all for your help thus far!

Jeff

Hi. You don’t have this in your revised code. Look at the instructions:

poster.user_id

Correct that and it should pass.

when there is only one parameter, the parentheses are optional, (unless you are using destructuring, then you need the parentheses )
the tests could expect them or not, ideally it should accept both, but when it doesn’t it would need to be reported on github for it to be fixed

return the result of checking if user.id is strictly equal to poster.user_id

Look at the property more closely. Note the _