Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

If no straight is rolled, your checkForStraights function should not enable the fourth or fifth radio button.

Your code so far

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

/* file: styles.css */

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

 const checkForStraights = (arr) => {
 console.log(arr.sort((a, b) => a - b));
 let count = 0;
 arr.forEach((value, index) => {
 if (arr[index] < arr[index + 1] && arr[index] === arr[index + 1] - 1) {
 count += 1;
 }
 
 })
  if (count === 4) {
 updateRadioOption(4, 40);
 updateRadioOption(3, 30);
  }
  else if (count === 3) {
  updateRadioOption(3, 30);
 }
  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();
    getHighestDuplicates(diceValuesArr);
    detectFullHouse(diceValuesArr);
  checkForStraights(diceValuesArr);
  }
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

check what your function does with [1,2,3,5,6]

i code using my phone only so i have no way of knowing since it only shows the steps that I’ve done incorrectly, but i tried to use comments and use console.log to check what’s the problem but apparently i should disable the fifth radio option now im lost

aren’t you able to add a checkForStraights([1,2,3,5,6]) and see what happens in the preview?