Review Algorithmic Thinking by Building a Dice Game - Step 10

Tell us what’s happening:

When your keepScoreBtn is clicked, the score should be updated in the totalScore text.
When your keepScoreBtn is clicked, the radio options should be reset.
When your keepScoreBtn is clicked, the score history should be updated.

I have these errors when I try to run my code, although I don’t know why.

I used the updateScore function to update the totalScore element and the scoreHistory, and I used resetRadioOptions, but it still tells me that I haven’t.

I would appreciate any help. Thanks!

Your code so far

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

/* file: styles.css */

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

keepScoreBtn.addEventListener("click", () => {
  const selectedOption = document.querySelector('input[name="score"]:checked');

  if(selectedOption) {
    updateScore(selectedOption.value, selectedOption.id);
    resetRadioOptions();
  } else {
    alert("alert")
  }
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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

Hi @jedrzej

When I roll the dice and select a score, the app does not perform the required functions.

I looks like the const variable does not seem to be working.

Also, your code should display a more meaningful message for the alert.

Happy coding

Yeah, the selectedOption variable was the problem. Thank you so much!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.