Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

Function fundamentally works as it should however what’s not are the outcome of my if statements. ive tried different variants following through both instructions and consoleinstructions(after running tests)

Your code so far

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

/* file: styles.css */

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

function checkForStraights (array){
const sortedArray = array.sort((a, b) => a - b).join('');
const myRegexOfFour = /(1234|2345|3456)/
const myRegexOfFive = /(12345|23456)/
if (myRegexOfFive.test(sortedArray)){
  console.log("Large Straight is true");
  
  
  updateRadioOption(5, 40);
  updateRadioOption(6,0)
 
  
  }
else if (myRegexOfFour.test(sortedArray)){
  console.log("Small Straight");
  updateRadioOption(4, 30);
     updateRadioOption(6,0)
   
  }
  else {updateRadioOption(6,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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

You are getting this error

Uncaught TypeError: Cannot set properties of undefined (setting ‘disabled’)

There isn’t a radio button at index 6, remember they are 0-indexed

You also need to filter out unique values as there might be duplicates.

Sorry. I didn’t realised it was a capturing group parenthesis so it won’t matter.