# Review Algorithmic Thinking by Building a Dice Game - Step 14

Tell us what’s happening:
Can you help me solve this.
I believe I have added the functionality request at this step but I am unable to pass the tests.

``````const checkForStraights = (array) => {
const counts = {};
let straight = 1;
let hCount = 1;

for (const num of array) {
counts[num] = counts[num] ? counts[num] + 1 : 1;
}

const countArr = Object.keys(counts).map((key) => key);
const sortedArr = countArr.sort((a, b) => {return a - b;});

for(let i = 0; i < sortedArr.length-1; i++){
if(parseInt(sortedArr[i]) === parseInt(sortedArr[i+1]-1)){
straight += 1;
}else{
hCount = straight;
straight = 1;
}
}

if(hCount === 5 ||straight  === 5){
}
if(hCount  === 4 || straight === 4 ){
}
}

if (rolls === 3) {
} else {
rolls++;
rollDice();
getHighestDuplicates(diceValuesArr);
detectFullHouse(diceValuesArr);
checkForStraights(diceValuesArr);
}
});
``````

Challenge Information

Review Algorithmic Thinking by Building a Dice Game - Step 14

hi there, welcome to the forum.