You could do like this:
function createRandomVowels(length) {
const vowels = ['a', 'e', 'i', 'o', 'u', 'y' ];
return Array.from({ length }, () => vowels[Math.floor(Math.random() * vowels.length)]);
}
console.log(createRandomVowels(2));
solved creating a function such as “createRandomVowels” that returns an array containing random vowels [closed]