Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

My solution to the final problem functions in the app but does not pass the test. It says:

If a large straight is rolled your function should enable the fourth radio button and update the displayed text.

I have seen a few forum posts about this problem and tried the prescribed solutions but no luck.

Is it possible that it is a browser issue?

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

const checkForStraights = (arr)=>{

  let consecutive = 0;
  arr.sort();
  for (let i=0; i<arr.length; i++){
    if (arr[i]+1 === arr[i+1]){
      consecutive += 1;
    }else if (consecutive < 3){
      consecutive = 0;
    }
  }  
  if (consecutive == 4){
    updateRadioOption(4, 40);
  }else if (consecutive == 3){
    updateRadioOption(3, 30);
  }
  updateRadioOption(5, 0);
}

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
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

If a large straight is rolled, your checkForStraights function should also enable the fourth radio button, set the value to 30 , and update the displayed text to , score = 30 .

Pay note to the “should also enable” part. So both radio buttons.

Ah thank you that was a basic oversight on my part.