The thing responding to my random array keeps going back to 0
<script>
var holes = document.getElementsByClassName("holes");
var container = document.getElementById("container");
function chooseHole() {
var randomNum = Math.floor(Math.random() * 6);
container.children[randomNum].id = "moleHole";
var moleHole = document.getElementById("moleHole");
moleHole.innerHTML = '<img src = "https://i.postimg.cc/30BdQDNP/pngtree-cartoon-mole-come-out-of-the-hole-picture-image-8497055.png">';
var randomTime = Math.floor(Math.random() * 2500);
function functionC() {
deleteMole();
}
setInterval(functionC, randomTime);
}
function deleteMole() {
var moleHole = document.getElementById("moleHole");
moleHole.innerHTML = "<img src = 'https://i.ibb.co/VDXK9Hw/Pngtree-cartoon-mole-come-out-of-the-hole-picture-image-8497055-2.png'>";
chooseHole();
}
chooseHole();
</script>
So far I’ve console.logged the random array number and that’s working correctly