Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

Please help me understand what I’m missing. I tested it by adding a console log and everything works, but for some reason the second test fails.
Not passing:
2. If a small straight is rolled, your checkForStraights function should enable the fourth radio button, set the value to 30, update the displayed text to , score = 30 and leave the fifth radio button disabled.

Your code so far

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

/* file: styles.css */

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


const checkForStraights = (array) => {

  const counts = array.sort();
  const seen = {}; 

  const filteredNums = counts.filter(num => { 
    if (!seen[num]) {
      seen[num] = true;
      return true;
    } else {  
      return false;
    }
  });

let straightCount = 0;
  for (let i = 0; i < filteredNums.length - 1; i++) {
    if ((filteredNums[i] + 1) === filteredNums[i + 1]) {
      straightCount++;
      
    } else {
      straightCount = 0;
      
    }
  } 

  if((straightCount + 1) >= 5) {
    updateRadioOption(3, 30);
    updateRadioOption(4, 40);
  } else if((straightCount + 1) >= 4) {
    updateRadioOption(3, 30);
  }
  updateRadioOption(5, 0);

}

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

// 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/138.0.0.0 Safari/537.36 OPR/122.0.0.0 (Edition Yx 05)

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

I have added a console.log(array) at the start of the function, then run the tests with the browser console open

doing this you can see what the function is called with and which input causes the error

in this case it’s [1,2,3,4,6] as it’s the last one printed before the error

examine what your function does with that one

Thank you, this helped me a lot!