Review Algorithmic Thinking by Building a Dice Game - Step 10

Tell us what’s happening:

amgetting the following error and i don’t know why :
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 selectedOption = null;
  for(const scoreInput of scoreInputs){
    if(scoreInput.checked){
      selectedOption = scoreInput;
      break;
    }
  }
  if(selectedOption){
    const value = parseInt(selectedOption.value);
    const id = selectedOption.id;
    updateScore(value, id);
    resetRadioOptions();
    scoreHistory.innerHTML += `<li>${id} : ${value}</li>`;
  }else{
    alert("you need to select an option");
  }
})

// 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/127.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 10

Have you tried to test your code by playing the game?
Do you notice anything unexpected?

what might be wrong here, the results only show after clicking the alert prompt 4times, it seems as though the code is looping the options again before displaying the result

-- removed--

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

alright… i also need help, that’s why i posted the code, the code is not working perfetly as it should

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.