Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

I don’t know what I’m missing. Getting an error

SyntaxError: unknown: Unexpected token (96:2)

94 | rulesContainer.style.display = “none”;
95 | }

96 | })
| ^

Your code so far

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

/* file: styles.css */

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

const getHighestDuplicates = (arr) => {
  const counts = {};

  for (let num of arr) {
    if(counts[num]){
      counts[num]++
    }
    else{
      counts[num] = 1;
    }
  } 
  let highestCount = 0;
  for(let num of arr){
   const count = counts[num];
   if(count >=3 && count > highestCount){
     highestCount = count;
   }
   if(count >=4 && count > highestCount){
     highestCount = count;
   }
  }
  const sumOfAllDice = arr.reduce((a,b)=> a+b,0);
  if(highestCount >= 4){
    updateRadioOption(1,sumOfAllDice);
  }
  if(highestCount >= 3){
    updateRadioOption(0,sumOfAllDice);
  }
  
    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(arr);
  }
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

Where is the end of the function that has this line in it?

Wow! I did not see that! Thank you!

1 Like