Tell us what’s happening:
My code seems to work correctly but when I’m trying to Submit the exercise I get this error: When your keepScoreBtn is clicked, the score should be updated in the totalScore text.
When your keepScoreBtn is clicked, the score history should be updated.
I tried to move the updateScore() function inside the if statement if(selectedValue){} but it does the same think. The same error.
The Total score is updating when I press the keepScoreBtn so I don’t understand what is wrong
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
keepScoreBtn.addEventListener("click", ()=>{
let selectedValue;
let achieved;
for (const radioButton of scoreInputs){
if(!radioButton.disabled){
achieved = radioButton.id;
selectedValue = radioButton.value;
break;
}
}
if (selectedValue){
rolls = 0;
round++;
updateStats();
} else{
alert("Select an Option");
}
updateScore(selectedValue, achieved)
resetRadioOptions()
console.log(selectedValue, achieved);
})
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 10