I attempted to initiate a delayed "one" call or a "one or two?" question, but instead of working as expected, the function continued running indefinitely. Surprisingly, everything worked perfectly fine without using setInterval.
quester2()
function quester2() {
for (i = 0; i <= finalCount; i++) {
let K = Math.ceil(Math.random() * 2);
if (K == 1) {
setInterval(function () { console.log("one"); }, 1000);
finalCount += 1;
allIterations += 1;
setInterval(function () { console.log("one or two?"); }, 1000);
} else {
setInterval(function () { console.log("one or two?"); }, 1000);
allIterations += 1;
}
}
console.log(finalCount);
console.log(i);
}