Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

Does anybody know what did I do wrong because when I run the code, it gives me this instructions: When the array has less than three of the same number, your getHighestDuplicates function should update the final radio option with , score = 0.

Your code so far

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

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

const getHighestDuplicates = (arr) => {
  const counts = {}
  
  for(const num of arr) {
    if(counts[num]) {
      counts[num] + 1
    }else {
      counts[num] = 1
    }
  }

  let highestCount = 0;
  for(const num of arr) {
    const count = counts[num];
    if(count >= 3 && count > highestCount) {
      highestCount = count
    }
    if(count >= 4 && count > highestCount)
      highestCount = count
  }
  diceValueArr.reduce((a,b) => a+b, 0);
  const sumOfAllDice = diceValueArr;

  if(highestCount >= 4) {
    updateRadioOption(1, sumOfAllDice)
  }
  if(highestCount >= 3) {
    updateRadioOption(0, sumOfAllDice)
  }
    
  updateRadioOption(5, 0); 
  

};


// 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/127.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

When does this line of code run?

Answer: every time getHighestDuplicates is called. Is that correct?

Hmmmmmm

this line code is referring to the final radio option, with the index 5, and a score of 0

Yes so, should it be updated all the time?

yes if the ‘three-of-a-kind’ has less than three of occurrences

“If”, kind of like an if statement?

Look at your previous updateRadioOption calls. The new one is missing something.