Tell us what’s happening:
I have tried a few different code variants that all work - but I still get the error that I have to update winnerMsgElement even when that is already I am doing with winnerMsgElement.innerText = …
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) {
winnerMsgElement.innerText = `${playerScore >= 3 ? "Player has won the game" : "Computer has won the game"}`;
optionsContainer.style.display = "none";
resetGameBtn.style.display = "block";
}
};
// 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/17.6 Safari/605.1.15
Challenge Information:
Review DOM Manipulation by Building a Rock, Paper, Scissors Game - Step 5