Help wanted

Hey all, I’m very new here but I wanted to share my project on codecademy with the crew. It would be great if someone could share with me parts that I have mistaken, and any other advice in general.


1 Like

I’m not the ‘crew’ but I can try and provide some help and a peer review but I don’t want to say too much and end up removing the satisfaction of you solving it for yourself.

So line 8 is fine though you don’t need to define another constant you can just return the value as is:

const generateTarget = () => Math.floor(Math.random())* 10;

Your compareGuesses function seems unfinished. You’re only checking if the guesses are the same and returning a string of “true” though I think you’re meant to return a Boolean.

You’re also not making use of the target parameter. You need to work out the distance between the guess and the target number for the computer and user guess and then use an if/else statement to return either true or false depending on which guess is closer to the target number.

Your function updateScore is incomplete. You can use a ternary operator here and you need to use the parameter winner to determine what to do with the scores defined at the very top of the code.

And your last function, advanceRound you don’t need to log anything. Just have your function execute the round increment which you logged to console and don’t define another currentRoundNumber, this is already defined at the top of the code.

Hope that helps, try and work through it some more but you’ve made a good start.


Hey @munroe4985, appreciate the help.

I updated my code after going through your comment. Also, having parameters was a requirement (for this project) on the part you suggested to insert a ternary operator, so I made it a function expression like it was before.

Here is the updated version. How does this look overall? I would love to get some additional advice.