Skip to content

Instantly share code, notes, and snippets.

@Luke-Rogerson
Created December 17, 2018 12:41
Show Gist options
  • Save Luke-Rogerson/92ce4a99d175385a52b58d684ad88f86 to your computer and use it in GitHub Desktop.
Save Luke-Rogerson/92ce4a99d175385a52b58d684ad88f86 to your computer and use it in GitHub Desktop.
Write a function that returns the number of vowels used in a string.
function vowels(str) {
const vowels = /[aeiou]/gi;
return str.split('').filter(char => char.match(vowels)).length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment