Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

I’ve almost got it but there is a typo or wrong } or something. Help and the last part is baffling me. I thought I did update it

Your code so far

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

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

const getHighestDuplicates = array => {
  let duplicates = {};
  array.forEach(number => {
    duplicates[number] = (duplicates[number]  || 0) + 1;
  });

  let maxCount = 0;
  let maxDuplicate
  let sum = array.reduce((sum, value) => sum + value, 0)
 
  for (const [duplicate, count] of Object.entries(duplicates)){ 
    if (count > maxCount) {
      maxCount = count;
      maxDuplicate = duplicate;
      };
  }

  if (maxCount > 3) {
    updateRadioOption(1, sum)
  }
  if (maxCount > 2) {
    updateRadioOption(0, sum)
    }
  if (maxCount < 3){
    
  }
  if (maxCount < 3){
    updateRadioOption.textContent = `, score = 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
/* 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 7

I took out the double if statements at the end.

  1. When the array has less than three of the same number, your
getHighestDuplicates

function should update the final radio option with

, score = 0

. 3. When the array has less than three of the same number, your

getHighestDuplicates

function should not update the first nor the second radio options. 8. You should call your

getHighestDuplicates

function when the dice are rolled.

Looking at these… updateRadioOption is a function or some element?