Review Algorithmic Thinking by Building a Dice Game - Step 10

Tell us what’s happening:

Hello,
although my code is working as expected (if I didn’t miss anything) it is not passing. Wondering what the issue might be.

Thanks in advance!

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

keepScoreBtn.addEventListener("click", () => {
                      
  for(let i = 0; i < scoreInputs.length; i++) {
    
    if(!scoreInputs[i].disabled && scoreInputs[i].checked) {
      updateScore(scoreInputs[i].value, scoreInputs[i].id );
      resetRadioOptions();
      break;
    }else if (i === scoreInputs.length - 1) {
      alert("Please select an option")
    }
  }

})

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 10

1 Like

remove the disabled check as the test is not expecting it (also a radio button cannot both be checked and disabled, that’s not possible)

1 Like

Many thanks! Removing the disabled check worked.
By negating the scoreInputs[i].disabled I was thinking of to include the option which is enabled and checked at the same time since more than one option could have the state enabled at the same time. But nonetheless I now realized that the scoreInputs[i].checked check is sufficient here.

1 Like

Hi! I was a bit confused as to how the code for the else if condition here relates to no option being selected