Tell us what’s happening:
My last issue is:
2. 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.
I’ve got a test case variable and when I pass it as the argument, the small straight functions as you’d expect so I really have no idea what the issue is.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
arr.sort((a, b) => a - b);
const arrStr = arr.join('');
const smallStraight = [1234, 2345, 3456];
const largeStraight = [12345, 23456];
if (largeStraight.some(straight => arrStr.includes(straight))) {
updateRadioOption(4, 40);
updateRadioOption(3, 30);
updateRadioOption(5, 0);
}
if (smallStraight.some(straight => arrStr.includes(straight))) {
updateRadioOption(3, 30);
updateRadioOption(5, 0);
}
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 (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