Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

Sorry, your code does not pass. Try again.

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.

Your code so far

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

/* file: styles.css */

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

function checkForStraights(arr){
  if (arr.sort().join('') === '12345' || arr.join('') === '23456'){
    
scoreInputs[4].value = 40

  }else if (
    arr.sort((a, b) => a - b).join('').includes('1234') || 
    arr.sort((a, b) => a - b).join('').includes('2345') || 
    arr.sort((a, b) => a - b).join('').includes('3456')
  ){
    // scoreInputs[3].disabled=false
scoreInputs[3].value = 30
// scoreInputs[3].textContent+=", score = 30"
  }else{
    scoreInputs[scoreInputs.length - 1].value = 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/127.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

You are meant to update the span score elements. Also, you have the updateRadioOption function you can use.