Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

I don’t know where am getting it wrong.

Your code so far

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

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

const checkForStraights = (arg) => {

const sortedDice = arg.sort((a, b) => a - b);
const diceNumber = Number(sortedDice.join(‘’));

if (diceNumber === 1234) {
updateRadioOption(3, 30)};

if (diceNumber === 12345) {
updateRadioOption(4, 40);
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

The dice values can reach up to 6. So a straight can be 23456

1 Like
  • this (join()) is throwing an error try using an un-formatted quote instead

when you fix that it will throw you an error message, see if that helps you figure it out, happy coding :slight_smile: