# Review Algorithmic Thinking by Building a Dice Game - Step 13: Loop ad infinitum

Without typing any code, if I inspect the page, click `console`, run the initial code for the tests to start and look at the console, I can see there are several potential loops:

Potential infinite loop detected on line 38. Tests may be failing because of this.
Potential infinite loop detected on line 120.
Potential infinite loop detected on line 20.
Potential infinite loop detected on line 33.
Potential infinite loop detected on line 51.

When I write the following simple code, a infinite loop starts occurring and the webpage ends up crashing:

``````const detectFullHouse = () => {
console.log("I am going to crash and I don't know why!");
}
``````
``````rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
(...)
} else {
(...)
detectFullHouse();
}
});
``````

I am using :

• Browser: Brave v1.66.115 Chromium: 125.0.6422.112 (Official Build) (64-bit);
• OS: Windows 11 Pro (23H2, OS build 22631.3737).

Can you please provide a link to the step?

I just ran into the same issue. I took a look at the source code on freeCodeCamp’s github, and I’m suspicious of the below test.

``````const counts = (arr) => arr.reduce((counts, num) => {counts[num] = ++counts[num] || 1; return counts}, {});
const isFullHouse = (arr) => arr.includes(3) && arr.includes(2) && arr.length === 2;
// Absurdly high, but will either timeout or bail early when assertion runs.
for (let i = 0; i < 100_000; i++) {
rolls = 0;
rollDiceBtn.click();
if (isFullHouse(diceValuesArr)) {
assert.isFalse(scoreInputs[2].disabled);
assert.strictEqual(scoreInputs[2].value, "25");
assert.strictEqual(scoreSpans[2].innerText, ", score = 25");
break;
}
}
``````

My understanding is diceValuesArr is guaranteed to be of length 5. Perhaps replace the call to isFullHouse with `isFullHouse(Object.values(counts(diceValueArr)))`? I think this would convert diceValueArr to an array of counts of occurrences and then pass the new array to isFullHouse?

I’m just placing here a link to the github’s challenge document.

Until this is fixed, nobody can solve the challenge. At least, I can’t.