I am working on ‘Review DOM Manipulation by Building a Rock, Paper, Scissors Game’. I am currently working on Step 4. I feel that I am answering correctly, but it keeps telling me I’m wrong. Here is my solution:
That’s the URL. I looked at step 5 and it had the same code as the code that I’d typed. I cut and pasted step 5 into step 4 and it was suddenly working. I must have made some kind of typo, but I swear… I just can’t see it. I must be doing something wrong, I guess.
You’re calling getRoundResultsafter the display for the round gets updated. That’s why your step is only working part of the time. Those parts of the time are only ties.
If we review the code for getRoundResults , we can see where the issue is.
function getRoundResults(userOption) {
const computerResult = getRandomComputerResult();
if (hasPlayerWonTheRound(userOption, computerResult)) {
playerScore++;
return `Player wins! ${userOption} beats ${computerResult}`;
} else if (computerResult === userOption) {
return `It's a tie! Both chose ${userOption}`;
} else {
computerScore++;
return `Computer wins! ${computerResult} beats ${userOption}`;
}
}
If the player wins or the computer wins; their score gets updated.
Actually, I left it out of the reply, but it was there after clicking the button. I think it’s just me. Sorry to bother you folks. I’m obviously out of my depth here.
If you have any question about specific curriculum challenge. Create your own topic to the challenge step by using Help button. That button appears below the challenge editor, when you attempting wrong code more than three times.