Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:

I am so lost here. I’ve tried so many times to get the function correct but still getting “Your checkForStraights variable should be a function” keeps flagging and I cant get passed:

const checkForStraights = (arr) => {
let sorted = arr.sort((a, b) => a - b);
let counter = 1;

for (let i = 0; i < 4; i++) {
if (sorted[i] + 1 === sorted[i + 1]) {
counter++;
} else if (sorted[i] !== sorted[i + 1]) {
counter = 1;
}
}

Your code so far

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

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

function checkForStraights(arr)  {
  let sorted = arr.sort((a, b) => a - b);
  let counter = 1; 

  for (let i = 0; i < 4; i++) { 
    if (sorted[i] + 1 === sorted[i + 1]) {
      counter++;
    } else if (sorted[i] !== sorted[i + 1]) { 
      counter = 1;
    }
  }

 if (counter === 5) {
  updateRadioOption(3, 40);
}
if (counter === 4) {
  updateRadioOption(2, 30);
}
if (counter < 4) {
  updateRadioOption(4, 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/127.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 14

This function is missing the closing brace } after the last line of code.

Thank you! That worked but now i’m still getting this 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"

I think it is good for you to try to decipher this hint.
What do you think it is trying to say is missing?