Tell us what’s happening:
Please, help me with this step.
My counter variable shows the expected results (it counts how much consecutive numbers are there among the dice), but I still can’t pass the challenge, it still says that when there is a small or a large straight the corresponding radio button should be updated
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
let sorted = arr.sort((a, b) => a - b);
let counter = 0;
for (let i = 0; i < 5; i++) {
if (sorted[i] + 1 == sorted[i + 1]) {counter++}
else {counter === 1}
}
if (counter === 5)
{ updateRadioOption(4, 40)
};
if (counter === 4) {
updateRadioOption(3, 30)
}
if (counter < 4) {
updateRadioOption(5, 0)
}
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Mobile Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14