Tell us what’s happening:
Hi can someone tell me what I did wrong? I don’t get the right score on the right radio button… For my feeling I did it right
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
arr.sort();
let b = 0;
for (let i = 1; i < arr.length; i++){
if (arr[i] !== arr[i - 1] + 1){
return false;
} else {
b++;
}
}
if (b === 3){
updateRadioOption(3, 30);
} if (b === 4){
updateRadioOption(4, 40);
} 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 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14