Tell us what’s happening:
Hello, I am still not passing the test #4 even though i am disabling all of them just to make sure, it keeps saying if there is no straight roll the input radio button 4 and 5 should not be enabled, what am i missing? please help.
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const checkForStraights = (array)=>{
const sorted = array.sort();
let results = [];
for(let i = 0; i < array.length - 1 ; i++){
if(sorted[i]-sorted[i+1] === 1 || sorted[i]-sorted[i+1] === -1){
results.push(1);
}else{
results.push(0);
}
}
const total = results.reduce((acc, result)=>acc+result);
if(total === 3){
updateRadioOption(3, 30);
updateRadioOption(5, 0);
}else if(total === 4){
updateRadioOption(3, 30);
updateRadioOption(4, 40);
updateRadioOption(5, 0);
}else{
resetRadioOptions();
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();
checkForStraights(diceValuesArr);
getHighestDuplicates(diceValuesArr);
detectFullHouse(diceValuesArr);
}
});
// 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/135.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14