Tell us what’s happening:
I think they made an error. This is not what they want in the instructions. The system is checking for this incorrect requirement and not passing
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (array) => {
let smallStraight = '';
let largeStraight = true;
let hand = [];
let straight = false;
const checkArr = [...new Set(array.sort((a,b) => b-a))]; //sorted decending and removed duplicates
console.log(checkArr + " line 139");
if(checkArr.length >= 4) {
for(let i = 0; i < array.length-2; i++) {
if (checkArr[i] - checkArr[i+1] === 1) {
hand.push(checkArr[i] - checkArr[i+1]);
console.log(hand);
straight = true;
} else {
console.log(straight + " line 149");
straight = false;
return; //determined hand is not straight
}
}
if(straight = true && checkArr.length < 5) {
console.log("smallstraight")
updateRadioOption(3, 30)
} else {
console.log("largestraight")
updateRadioOption(4, 40)
}
} else
updateRadioOption(5, 0)
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 300) {
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
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14