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.
even though It is working for the small straight.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) =>{
let f=0;
for(let i=0; i<4; i++){
if(arr[i]+1 === arr[i+1]){
f++;
}
}
if(f===3){
updateRadioOption(3,30);
}else if(f===4){
updateRadioOption(4,40);
}
console.log(f)
updateRadioOption(5, 0);
};
let arr2=[1,3,4,5,6];
checkForStraights(arr2);
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/135.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14
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.