Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

I have 2 issues left in my Code but I don’t know how to fix it. It must be in this line, because it says “4. 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.
5. When the array has three of the same number, your getHighestDuplicates function should not update the Four of a Kind radio option.”:
//check if Four of a Kind

if (Object.values(counts).some(count => count >= 4)) {
updateRadioOption(0, total);
updateRadioOption(1, total);

}
//check if Three of a Kind

else if (Object.values(counts).some(count => count >= 3)) {
updateRadioOption(1, total);

}
// if nothing compares
else {
updateRadioOption(5, 0);

}
}

Your code so far

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

/* file: styles.css */

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

function getHighestDuplicates(diceValuesArr) {
  const counts = {};
  let total = 0;

  diceValuesArr.forEach(ele => {
    if (counts[ele]) {
      counts[ele] += 1;
      total += ele;
    } else {
      counts[ele] = 1;
      total += ele;
    }
  });
  
//check if Four of a Kind

  if (Object.values(counts).some(count => count >= 4)) {
    updateRadioOption(0, total);
    updateRadioOption(1, total);
    
  } 
  //check if Three of a Kind 

  else if (Object.values(counts).some(count => count >= 3)) {
    updateRadioOption(1, total);
    
  } 
  // if nothing compares
  else {
    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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

I tried to get the three of kinds roll, this is the result:

Hi there!
Don’t use the actual array diceValuesArr as a parameter within the function.