I am in need of assistance. I have created some code that puts the vowels in an interval. It is working fine, however, once it cycles through the 6 letters (aeiouy) it stops. How will I be able to make this loop continuously and loop through letters indefinitely?
Thanks in advance!
// Vowel string
var vowels = 'aeiouy'.split('');
// start button
levelButton2.addEventListener("click", function () {
for (y = 0; y < vowels.length; y++) {
setTimeout(() => getRandom(vowels), y*1000);
}
});
// Function that gives me random letters
function getRandom (letters) {
var randomSet = letters[Math.floor(Math.random() * letters.length)];
console.log('set random' , randomSet)
document.getElementById("demo3").innerHTML = randomSet;
};