Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:
Can you help me solve this.
I believe I have added the functionality request at this step but I am unable to pass the tests.

Your code so far

const checkForStraights = (array) => {
  const counts = {};
  let straight = 1;
  let hCount = 1;

  for (const num of array) {
    counts[num] = counts[num] ? counts[num] + 1 : 1;
  }
  
  const countArr = Object.keys(counts).map((key) => key);
  const sortedArr = countArr.sort((a, b) => {return a - b;});

  for(let i = 0; i < sortedArr.length-1; i++){
    if(parseInt(sortedArr[i]) === parseInt(sortedArr[i+1]-1)){
      straight += 1;
    }else{
      hCount = straight;
      straight = 1;
    }
  }

  if(hCount === 5 ||straight  === 5){
    updateRadioOption(4, 40);
  }
  if(hCount  === 4 || straight === 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);
  }
});

Challenge Information

Review Algorithmic Thinking by Building a Dice Game - Step 14

hi there, welcome to the forum.
Normally adding a link to the exercise is useful to make it easier for people who want to answer you to read your question in context.
I will edit your post to add the link.

I am currently stuck on this Step as well! The correct code would be greatly appreciated!
Here is a link to the specific step: