Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

Hi, I tried the game it seems to be working but it is not allowing me to pass. It shows the following errors, what have I missed in my code? Thanks all

When the array has three of the same number, your getHighestDuplicates function should update the Three of a Kind radio option with , score = and the total sum of the dice.

When the array has four of the same number, your getHighestDuplicates function should update the Four of a Kind radio option with , score = and the total sum of the dice.

Your code so far

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

/* file: styles.css */

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

const reset = () => {
  scoreInputs.forEach((input, index) => {
    input.disabled = true;
    input.value = 0;
    scoreSpans[index].textContent = ``;
  })
}

const getHighestDuplicates = (array) => {
  reset();
  const obj = {};
  
  array.forEach(item=>{
    obj[item] = (obj[item] || 0) +1;
  });
  
  const sorted = Object.entries(obj).sort((a, b) => b[1] - a[1]);

  let sum = diceValuesArr.reduce((accumulator, currentValue) => { 
    return accumulator + Number(currentValue)
  }, 0)

  sorted.forEach((value)=>{
    if(value[1] === 5){
    } else if (value[1] === 4){
      updateRadioOption(0, sum);
      updateRadioOption(1, sum);
    } else if (value[1] === 3){
      updateRadioOption(0, sum);
    } else if (value[1] < 2) {
      updateRadioOption(5, 0);
    }
  })
}

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

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

this is your function, right?

you have the parameter
so then why you don’t always use it?

Just learned that I must return the value in a function, and to call the function! Thanks for your help