Created
December 17, 2018 12:41
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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