Tell us what’s happening:
Please, explain why this code didn’t pass the test .
const checkForStraights = (array)=>{ 134 const sorted = array.sort((a,b)=>a-b) 135 const nopair = […new Set(sorted)).join(“”) 136 const smallRegex = /^1234$/ 137 const largeRegex = /^12345$/ 138 if (smallRegex.test(nopair)){ 139 updateRadioOption(3, 30) 140 } 141 if (largeRegex.test(nopair)){ 142 | updateRadioOption(4,40) 143 } 144 else { 145 updateRadioOption(5,0) 146 } 147 }
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const checkForStraights = (array)=>{
const sorted = array.sort((a,b)=>a-b)
const nopair = [...new Set(sorted)].join("")
const smallRegex = /^1234$/
const largeRegex = /^12345$/
if (smallRegex.test(nopair)){
updateRadioOption(3, 30)
}
if (largeRegex.test(nopair)){
updateRadioOption(4, 40)
}
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);
checkForStraights(diceValuesArr)
}
});
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 OPR/90.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14