Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

Buenas. He probado el codigo y funciona, pero me sigue tirando un error:

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

Por favor alguien que me pueda guiar! Gracias

Your code so far

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

/* file: styles.css */

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



const checkForStraights = (diceValuesArr) => {
  const sorted = diceValuesArr.slice().sort((a, b) => a - b).toString();

  if (sorted === "1,2,3,4" || sorted === "2,3,4,5" || sorted === "3,4,5,6") {
    updateRadioOption(3, 30);
    updateRadioOption(4, 0); 
  } else if (sorted === "1,2,3,4,5" || sorted === "2,3,4,5,6") {
    updateRadioOption(4, 40); 
    updateRadioOption(3, 30);
  } else {
    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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

Hi @javiermig

The sorted variable contains five elements, so will never match the four items in the string.

Happy coding