Tell us what’s happening:
I cant pass the 2nd test
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.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
const str = [...new Set(arr)].sort((a, b) => a - b).join("");
console.log(str)
const smallstr = ["1234", "2345", "3456"];
const largestr = ["12345", "23456"];
if (largestr.includes(str)) {
updateRadioOption(4, 40); // Large straight
updateRadioOption(3, 30);
}
if (smallstr.includes(str)) {
updateRadioOption(3, 30); // Small straight
}
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/138.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14