Tell us what’s happening:
i need help with my if stataement the part of largestraights else
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function checkForStraights (diceValuesArr){
const unique = [...new Set(diceValuesArr)].sort((a, b) => a - b);
const filtered = unique
.map((_, i) => unique.slice(i, i + 4))
.filter(subArr => subArr.length === 4);
const smallStraights =
filtered.filter(f => f[3] - f[0] === 3).length > 0;
const largeStraights =
unique.length === 5 && unique[4] - unique[0] === 4;
if(smallStraights){
updateRadioOption (3, 30);
}else if (largeStraights){ /* ineed help in this part */
updateRadioOption (3, 30);
updateRadioOption (4, 40);
}else{
updateRadioOption (0,0);
}
/*co
nst updateRadioOption = (index, score) => {
scoreInputs[index].disabled = false;
scoreInputs[index].value = score;
scoreSpans[index].textContent = `, score = ${score}`;*/
};
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);
}
});
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14