Tell us what’s happening:
I am having difficulty with this last step. From what I can see my checkForStraights() function fulfills all the requirements but I still get “If a small straight is rolled, your checkForStraights function…” error when I try to check it. I don’t know if maybe there is a typo or syntaxError I am not seeing.
Any assistance would be greatly appreciated.
Thank you!
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
const sortedDice = arr.sort((a,b) => a-b);
const diceNumber = Number(sortedDice.join(''));
const smallStraight = [1234, 2345, 3456];
for(let i=0; i<smallStraight.length; i++){
if(diceNumber === smallStraight[i]){
updateRadioOption(3, 30)
};
}
if(diceNumber === 12345 || 23456){
updateRadioOption(3, 30);
updateRadioOption(4, 40);
}
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();
}
});
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14