Tell us what’s happening:
Hi, this function work but i don’t know why i can’t pass this step.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
let counts = {}
for (const num of arr){
counts[num] = counts[num] ? counts[num] + 1 : 1
}
const keys = Object.keys(counts).join('')
const smallStraight = 1234 || 2345 || 3456
const largeStraight = 12345 || 23456
if(keys.includes(smallStraight)){
// console.log('small work')
updateRadioOption(3, 30)
}
if(keys.includes(largeStraight)){
// console.log('large work')
updateRadioOption(4, 40)
}
updateRadioOption(5, 0)
}
// checkForStraights([1,2,3,4,5])
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; rv:132.0) Gecko/20100101 Firefox/132.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14