The issue was inside the if condition.
Before it was :(clickedIndexes.length + 1 !== getData.animalImages.length)Now it looks like that:if (clickedIndexes.length + 1 <= getData.animalImages.length) { let audios = [/assets/audio/count/${clickedIndexes.length + 1}_${getData.voice.toLowerCase()}es.wav]; if (!isImmersive) { audios.push(/assets/audio/count/${clickedIndexes.length + 1}${getData.voice.toLowerCase()}_en.wav); } addAudio(audios); }
Code in CountWithMeGame was cleaned up
setAllAnimallsClicked() was wrapped in setTimeout to have the pause between animals number audio and count questions audio
(clickedIndexes.length + 1 !== getData.animalImages.length)
Now it looks like that:if (clickedIndexes.length + 1 <= getData.animalImages.length) { let audios = [
/assets/audio/count/${clickedIndexes.length + 1}_${getData.voice.toLowerCase()}es.wav]; if (!isImmersive) { audios.push(
/assets/audio/count/${clickedIndexes.length + 1}${getData.voice.toLowerCase()}_en.wav); } addAudio(audios); }
setAllAnimallsClicked()
was wrapped insetTimeout
to have the pause between animals number audio and count questions audio