Tell us what’s happening:
I have updated the innerText from the winnerMsgElement inside IF statements and I have return the winnerMsgElement by the end of the code, so i dont really know what is wrong . But it keeps saying that i have to update the winnerMsgElement
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const playerScoreSpanElement = document.getElementById("player-score");
const computerScoreSpanElement = document.getElementById("computer-score");
const roundResultsMsg = document.getElementById("results-msg");
const winnerMsgElement = document.getElementById("winner-msg");
const optionsContainer = document.querySelector(".options-container");
const resetGameBtn = document.getElementById("reset-game-btn");
function showResults(userOption) {
roundResultsMsg.innerText = getRoundResults(userOption);
computerScoreSpanElement.innerText = computerScore;
playerScoreSpanElement.innerText = playerScore;
if(playerScore ==3 || computerScore ==3 ){
resetGameBtn.style.display=block;
optionsContainer.style.display=none;
if(playerScore ==3){
winnerMsgElement.innerText= "Player has won the game!"
}
else if (computerScore==3){
winnerMsgElement.innerText= "Computer has won the game!"
}
return winnerMsgElement
}
};
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Challenge Information:
Review DOM Manipulation by Building a Rock, Paper, Scissors Game - Step 5