Skip to content

patgarcia/is-vowel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

is-vowel

Check if character is a vowel

const isVowel = char => /[aeiou]/i.test(char);

It could be used in a recursion to count vowels in a string

const countVowels = str => !str?.length ? 0 : isVowel(str[0]) + countVowels(str.slice(1));

Regex breakdown

  • / regex boundary
  • [] group bracket expression matching single chars it contains
  • aeiou chars to test against
  • i case insensitive flag

About

Check if character is a vowel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published