Tell us what’s happening:
Task is to create function to check for small and large straights and prime appropriate radio buttons.What is wrong?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function checkForStraights(arr) {
let count = 1;
for (let i = 1; i < arr.length; i++) {
if (arr[i] === arr[i - 1] + 1) {
count++;
if (count === 6) {
updateRadioOption(5, 40);
updateRadioOption(4, 30);
updateRadioOption(6, 0);
} else if (count === 5) {
updateRadioOption(4, 30);
updateRadioOption(6, 0);
}
} else if (count === 1) {
updateRadioOption(6, 0);
}
}
}
console.log(checkForStraights);
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 Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14