Review Algorithmic Thinking by Building a Dice Game - Step 12

Tell us what’s happening:

Your resetGame function should set both score and rolls to 0, and round to 1. I have set the values to 0 and 1 yet I am still receiving the same issue. Please do let me know if you can help me out in any way. Thank you in advance

Your code so far

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

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

const resetGame = () => {
  listOfAllDice.forEach((dice)=> dice.textContent = 0);
  score = 0;
  rolls = 0;
  round = 1;
  totalScoreElement.textContent = score;
  rollsElement.textContent = rolls;
  roundelement.textContent = round;
  scoreHistory.innerHTML = "";

};

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);
  }
});

rulesBtn.addEventListener("click", () => {
  isModalShowing = !isModalShowing;

  if (isModalShowing) {
    rulesBtn.textContent = "Hide rules";
    rulesContainer.style.display = "block";
  } else {
    rulesBtn.textContent = "Show rules";
    rulesContainer.style.display = "none";
  }
});

keepScoreBtn.addEventListener("click", () => {
  let selectedValue;
  let achieved;

  for (const radioButton of scoreInputs) {
    if (radioButton.checked) {
      selectedValue = radioButton.value;
      achieved = radioButton.id;
      break;
    }
  }

  if (selectedValue) {
    rolls = 0;
    round++;
    updateStats();
    resetRadioOptions();
    updateScore(selectedValue, achieved);
    if (round > 6) {
      setTimeout(() => {
        alert(`Game Over! Your total score is ${score}`);
      }, 500);
      resetGame();
    }
  } else {
    alert("Please select an option or roll the dice");
  }
});

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 12

Hi again @fortechaditya,

Your solution is correct except for a typo in your code. Inside the resetGame function, the element for rounds should be roundElement not roundelement. Please make the word element start with capital letter.

Happy coding!