Review Algorithmic Thinking by Building a Dice Game - Step 10

Tell us what’s happening:

My code currently not being accepted but it works and it is right. I’ve tried to look for those who had the similar problems like I have, but I think there’s none. I’m having problems with the updateScore function, it updates the score history but I was given a hint that “When your keepScoreBtn is clicked, the score history should be updated.”.

Your code so far

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

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

const options = document.getElementsByName('score-options');
keepScoreBtn.addEventListener("click", () => {
  const optionLabels = document.querySelectorAll('#score-options label');
  let hasSelected = false;
  for(let i = 0; i < options.length; i++){
      if(options[i].checked){
        updateScore(scoreInputs[i].value, optionLabels[i].firstChild.textContent);
        rolls = 0;
        round++;
        updateStats();
        resetRadioOptions();
        hasSelected = true;
      }
    }
  if(!hasSelected){
    alert("Please select an available option");
  }  
  }
)

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 10

Welcome to the forum @gianraphaelbaldovino

When that button is clicked, you should find which radio option is checked and capture its value and id attributes.

It looks like you are accessing the label element instead of the input element.

Happy coding

understood, thank you!

1 Like