Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

step7, I tried a 2d for loop to check for duplicates, but it does’nt work

Your code so far

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

/* file: styles.css */

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

function getHighestDuplicates(arr){
    let dup = 0
    let sum = 0
    for(let i = 0;i<=arr.length;i++){
      sum += arr[i]
      for(let l = 0;l<=arr.length;l++){
        if(arr[i]===arr[l]){
          dup++
        }
      }
    }
    if(dup==3){
updateRadioOption(0,sum)
    }else if(dup==4){
updateRadioOption(1,sum)
    }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()
  }
});

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

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

can you explain more what you mean by ‘it doesn’t work’?
You may benefit from trying to explain your algorithm to someone (or to us) and also from trying to add some logs to your code so you can identify the issues with it.

i get this when running the code
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.

alrighty, that’s what the check from the step says.
How about you? What have you done to try to debug?
(please consider what I said earlier as 2 methods to move forward)