Tell us what’s happening:
I think I’ve got it right? Is there something I’m doing wrong? It won’t pass, but it does exactly what is asked…
Create a resetRadioOptions
function. Your function should iterate through the scoreInputs
to disable them and remove the checked
attribute. Your function should also remove the text from each of the scoreSpans
. Finally, call this function before you roll the dice.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const resetRadioOptions = () => {
for (let i = 0; i < diceValuesArr.length; i++){
scoreInputs[i].disabled = true;
scoreInputs[i].checked = false;
scoreSpans[i].textContent = "";
}
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
resetRadioOptions();
rollDice();
updateStats();
getHighestDuplicates(diceValuesArr);
}
});
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 8