Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

failing 2, 4, and 7th tests, not sure what I’m doing wrong here

Your code so far

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

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

  
  const sumDice = diceValuesArr.reduce((acc, curr) => acc + curr, 0)
  
  
  const getHighestDuplicates = (numbers, sumDice) => {
    const counts = {}
    for (let num of numbers){
      if (counts[num]){
        counts[num]++
      } else {
          counts[num] = 1
      }   
    }
    for (let num of numbers){  
      if (counts[num] < 3){
        scoreSpans[5].textContent = ", score = 0";
    } else if (counts[num] === 3){
        scoreSpans[0].textContent = `, score = ${sumDice}`;
    } else if (counts[num] === 4){
        scoreSpans[1].textContent = `, score = ${sumDice}`;
  }
  }
  }
  
  


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

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

Normally you can’t proceed with out finishing one before the other, so it looks like you’re stuck on 7 is this correct?

Yes, I did some tinkering and now I’m stuck at 4, 6, and 7. Any insight is appreciated.

Hi @bastugugur85

Doing this one at a time.

Problem:

running tests 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.

Work towards solution:

If a number appears four or more times, you will need to update the Four of a Kind option with your updateRadioOption function.

The keyword for this is invoke the updateRadioOption function.

Happy coding