DEV Community

Discussion on: Algorithms: Find the Vowels

rem113 profile image
Rem113 • Edited on

Looks like you are solving it with JS. I would use a more functional style:

function countVowels(text) {
  const vowels = ['a', 'e', 'i', 'o', 'u'];
  return text
    .filter((c) => vowels.includes(c))
Enter fullscreen mode Exit fullscreen mode

It looks better to me, though yours is perfectly valid.