Tell us what’s happening:
why it said that “if a large straight is rolled, update the score and set the value to 30” while the task said that large straight resulting 40 ??? please help me
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
const sorted = arr.toSorted((a, b) => a - b)
let count = 0
for (let i = 1; i < 5; i++) {
if (sorted[i] - sorted[i - 1] === 1) {
count++
}
}
if (count === 3) {
updateRadioOption(3, 30);
}
if (count === 4) {
updateRadioOption(4, 40);
}
updateRadioOption(5, 0);
}
checkForStraights([5,4,6,3,1])
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14