DEV Community

Discussion on: Understanding Javascript Array Series VII - Array Loops & Iteration Part IV

Collapse
 
pavilandoangelo profile image
Angelo Pavilando

// Return an array of all words that begin with a vowel in the given array
const randomWords = ["Nedy", "Adesoji", "Akaniru", "Umbrella", "Barcelona", "Xylophone"];
const startWithVowelWords = randomWords.filter((random_word) => {
const vowels = ["a", "e", "i", "o", "u"];
return vowels.includes(random_word.toLowerCase().substring(0,1))
});

Collapse
 
nedyudombat profile image
Nedy Udombat • Edited

Nice solution @pavilandoangelo 👍