Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

Tests 2,3,4 aren’t passing but my own tests work fine. E.g (6,5,4,3,2) and (1,2,3,4,6) update the radio buttons to be: large,small, none OR small, none respectively. Am i doign something wrong?

Your code so far

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

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

const checkForStraights = (arr) => {
  let straightCount = 0;
  let reverseCount = 0;
  
  for(let i = 0; i < arr.length -1;i++){
    
    const currentNum = parseInt(arr[i]);
    //probably shouldve just sorted this but oh well
    if(currentNum + 1 == arr[i+1]){
      reverseCount = 0;
      straightCount++;
    }else if(currentNum -1 == arr[i+1]){
      straightCount = 0
      reverseCount++;
    }else{
      straightCount = 0;
      reverseCount = 0;
    }
    if(straightCount == 3 || reverseCount == 3){
      updateRadioOption(3,30);
    }else if(straightCount ==4 || reverseCount == 4){
      updateRadioOption(4,40);
    }else{
      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();
    const straightArrTest = [3,4,5,6,6]
    getHighestDuplicates(diceValuesArr);
    checkForStraights(diceValuesArr);
    detectFullHouse(diceValuesArr);
    console.clear()

  }
});

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

You will need to sort the array because it may show up as 5,3,2,6,4 which is still a straight.

Also don’t put this line of code in the else.
It needs to run all the time.

Also, a straight should not be only 3 numbers in a row. It should be 4 or 5 consecutive numbers.

And note that a large straight included a small one so it should update two radio buttons.