Tell us what’s happening:
I keep getting an error message saying the function should return a string. I think I’m missing something on return statements and I wouldn’t mind some help.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function getRoundResults(userOption) {
const computerResult = getRandomComputerResult();
if(hasPlayerWonRound(userOption, computerResult)){
playerScore++;
return `Player wins! ${userOption} beats ${computerResult}`
}else if(userOption === computerResult){
return `It's a tie! Both chose ${userOption}`
}else{
computerScore++;
return `Computer wins! ${computerResult} beats ${userOption}`
}
}
console.log(getRoundResults("Rock"));
console.log("Player Score: ", playerScore, "Computer Score: ", computerScore);
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
Review DOM Manipulation by Building a Rock, Paper, Scissors Game - Step 3