Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

The error:
“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.”

Yet the code works properly and changes proper radios.

Your code so far

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

//part of the code
const rollDice = () => {
  diceValuesArr = [];

  for (let i = 0; i < 5; i++) {
    const randomDice = Math.floor(Math.random() * 6) + 1;
    diceValuesArr.push(randomDice);
  };

  listOfAllDice.forEach((dice, index) => {
    dice.textContent = diceValuesArr[index];
  });

  scoreInputs.forEach((input, index) => {
    input.disabled = true;
    scoreSpans[index].textContent = ""
  })
  getHighestDuplicates(diceValuesArr)
};

const updateStats = () => {
  currentRoundRolls.textContent = rolls;
  currentRound.textContent = round;
};

const updateRadioOption = (index, score) => {
  scoreInputs[index].disabled = false;
  scoreInputs[index].value = score;
  scoreSpans[index].textContent = `, score = ${score}`;
};
function getHighestDuplicates(nums) {
  let highestDuplicate = 0;

  nums.forEach(num1 => {
    let freq = 0;

    nums.forEach(num2 => {
      if (num1 === num2) freq++
    });

    if (freq > highestDuplicate) highestDuplicate = freq;
  });

  if (highestDuplicate === 3) {
    let sum = arrSum(diceValuesArr)
    console.log(sum)
    updateRadioOption(0, sum)
    // if (highestDuplicate === 4) {
    //   updateRadioOption(1, sum)
    // }
  } else if (highestDuplicate < 3) {
    updateRadioOption(5, 0)
  }
}

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

I am also facing similar problem. :thinking:

My code is working, but I get the error message when checking it.