### Your browser information:
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0</code>
### Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/review-algorithmic-thinking-by-building-a-dice-game/step-14`function checkForStraights(array) {
const sortedStr = array.sort((a, b) => a - b).join("");
if (/12345/.test(sortedStr)) {
updateRadioOption(4, 40);
} else if (/1234/.test(sortedStr)) {
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++;
res
### Your code so far
```html
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function checkForStraights(array) {
const sortedStr = array.sort((a, b) => a - b).join("");
if (/12345/.test(sortedStr)) {
updateRadioOption(4, 40);
} else if (/1234/.test(sortedStr)) {
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);
}
});`
can you remove extra content from the code blocks? I am not sure what is your code and what was accidentally added.
As a reminder, here how to format code blocks:
When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
but you should test array like these too: [3,4,5,6] and maybe 12234 etc… you should convert your array to a set or you should take repeated item from array and convert to an object. for example this is my code and it worked:
code removed by moderator
and do not forget add checkForStraights(diceValuesArr) to rollDiceBtn.addEventListener. there in else.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.