Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

i am having a problem when it comes to putting a score and also understanding

Your code so far

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

/* file: styles.css */

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

// the problems lies below 

function getHighestDuplicates (diceValuesArr) {
  let score = 0;
  let counts = {};
    diceValuesArr.forEach(num => {
        counts[num] = (counts[num] || 0) + 1;
        score+=num;
    });

  
    for (let num in counts) {
        if (counts[num] >= 4) {
           updateRadioOption(1, score); 
            
        } else if (counts[num] >= 3) {
             updateRadioOption(0, score); 
        }else{
          updateRadioOption(0,score);
        }
    }

getHighestDuplicates();

}



rollDiceBtn.addEventListener("click", () => {
  if (rolls === 3) {
    alert("You have made three rolls this round. Please select a score.");
  } else {
    rolls++;
    rollDice();
    updateStats();
    
  }
});

// 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/137.0.0.0 Safari/537.36 Edg/137.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

The problem is that the getHighestDuplicates function is being called without any arguments inside its own definition. This means diceValuesArr will be undefined, causing an error.

Solution: Remove the call to getHighestDuplicates() from within the function. The function should be called elsewhere with the actual dice values, for example, after the dice are rolled. Additionally, the score calculation for duplicates should likely be based on the value of the duplicated dice, not the sum of all dice.

is this how you update the last radio button with a score of 0?