Tell us what’s happening:
The keepScoreBtn is created and actually working properly, but i cant pass the test, not sure why. It said that when the btn is clicked the scoreHistory should be update, and when i try it its update with no issue, so i need help understanding where is the problem if any of you guys can have a look, i would very much appreciate it.
The message is:
Sorry, your code does not pass. You’re getting there.
When your keepScoreBtn is clicked, the score history should be updated.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
keepScoreBtn.addEventListener("click", () => {
let selectedOptionIndex = -1;
scoreInputs.forEach((input, index) => {
if (input.checked) {
selectedOptionIndex = index;
}
});
if (selectedOptionIndex !== -1) {
const selectedValue = scoreInputs[selectedOptionIndex].value;
let achieved = "";
switch (selectedOptionIndex) {
case 0:
achieved = "three of a kind";
break;
case 1:
achieved = "four of a kind";
break;
default:
achieved = "none";
}
updateScore(selectedValue, achieved);
rolls = 0;
round++;
updateStats();
resetRadioOptions();
} else {
alert("You have made three rolls this round. Please select a score.");
}
});
// 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 Edg/126.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 10