Tell us what’s happening:
I have no clue why its not passing. when i roll a straight it does what it sould do: show the score, updates the value correctly, enables the right button/ buttons, and picking a score and clicking keep scores does correctly update the score. when i click the check your code button it tells me
- If a small straight is rolled, your “checkForStraights” function should enable the fourth radio button, set the value to “30”, and update the displayed text to “, score = 30”
- If a large straight is rolled, your “checkForStraights” function should also enable the fourth radio button, set the value to “30”, and update the displayed text to “, score = 30”
- You should call the “checkForStraights” function when the “rollDiceBtn” is clicked
even though my code does do all of that
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (numArr) => {
const sorted = numArr.sort((a, b) => a-b);
console.log(sorted)
const sortedStr = sorted.join("");
console.log(sortedStr)
if (sortedStr.includes("12345" || "23456")) {
updateRadioOption(4, 40);
updateRadioOption(3, 30);
} else if (sortedStr.includes("1234" || "2345" || "3456")) {
updateRadioOption(3, 30);
} 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; rv:135.0) Gecko/20100101 Firefox/135.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14